How to include a .php and a .js file to whole project?


I want to include a .php file and a .js file into the whole suiteCRM. What is the best practice? Where to copy the source and in which file to include them?

It would depend on what you want those files to do? You could look into adding a custom Entry point but you really need to give more information.

I need to use Hijri date. Actually I want to use this:

jDateTime is a PHP class to convert dates from Gregorian calendar system to Jalali calendar system and vice versa. Supports dates beyond 2038.
Jalali, also known as Shamsi or Hijri Shamsi is the Iranian calendar system.


Like so



$hook_version = 1; 
$hook_array = Array(); 

$hook_array['after_ui_frame'] = Array();
$hook_array['after_ui_frame'][] = array(
  1, //Hook version
  'Adds cisco javascript to page to enable Click To Dial/Logging.',  //Label
  'custom/include/click2calls/ciscoJS.php', //Include file
  'ciscoJS', //Class
  'echoCiscoJS' //Method


And the files ciscoJS.php :


if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

class ciscoJS{

  function echoCiscoJS($event,$arguments){
	global $sugar_config;

	if(  (!isset($_REQUEST['sugar_body_only']) || $_REQUEST['sugar_body_only']!=true) && $_REQUEST['action']!='modulelistmenu' && $_REQUEST['action']!='Popup' && empty($_REQUEST['to_pdf']) && ( !empty($_REQUEST['module']) && $_REQUEST['module']!='ModuleBuilder') && empty($_REQUEST['to_csv'])){

		     echo '<link rel="stylesheet" type="text/css" media="all" href="custom/include/click2calls/cisco.css">';
			echo '<script> userExt = ' . $userExt . ';</script>';
			echo '<script type="text/javascript" src="custom/include/click2calls/dialout.js"></script>';





1 Like

I didn’t understand. You just gave me a file name and bunch of codes. Would you please elaborate?

Is this for every date in the entire system or only certain dates in some modules?

He just showed you how to create an after_ui_frame logic hook for a custom module. Although I am not 100% sure what Item is trying to tell you.
More information here:

Module logichooks:

It is for every date in the entire system. In order to use it in Persian language, along with translation and RTL direction in CSS we need Hijri date. So the entire system.

Unless you are willing to do it on the fly,such as implement logic hooks that convert dates on page load etc which would probably slow the system down then I think to do it properly would be a big job involving a lot of changes to core files and you would likely run into many many bugs and issues. In fact i wouldn’t even want to contemplate doing that sorry :unsure: That is a job for a professional coding outfit.

1 Like

The question is : “How to include a .php and a .js file to whole project?”

Then i give code for this.
This is not for custom module, look the path of the first file : custom/modules/logic_hook.php => global logic_hook
The code in this file (see above) execute on all module this file : ‘custom/include/click2calls/ciscoJS.php’, //Include file
The content of this file is (see above)

  • echo a JS file and a CSS file.

Then, i respond at the question “How to include a .php and a .js file to whole project?” “JS; PHP;CSS” :wink:

My code do a click2call, all Phone field (mobile, office; alternate, etc) on all module and custom module become clickable and do a SIP request to a PBX.



Do you know anyone who is willing to? :smiley:

Désolé, je ne comprends pas.
Mais si vous avez un conseil pour aider la communauté, je suis preneur.

Comment ajouter un bouton close dans les tickets ?

Would you please reply in English?

Yes i can do :

i am sorry, i dont understand.
But if you have a advice to the community, i will take it,
How add a close buton for case.