How do I include file config.php/config_override.php in logic hook ?

I saw some error in log

PHP Warning:  include(../config_override.php): failed to open stream: No such file or directory in /var/www/sugarcrm/htdocs/custom/users_hooks.php on line 3

PHP Warning:  include(): Failed opening '../config_override.php' for inclusion (include_path='/var/www/sugarcrm/htdocs:/var/www/sugarcrm/htdocs/vendor:.:/usr/share/php:/usr/share/pear') in /var/www/sugarcrm/htdocs/custom/users_hooks.php on line 3

then I edit

//from

include('../config_override.php');
//to
include('config_override.php');

error has gone

my file hook is in ./custom

<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
include('config_override.php');
...

when I try this

$GLOBALS['log']->fatal($sugar_config['domain']);

no value shown

What can I do or I do something wrong ?

Sugar 7.6 Ent

Thanks,

M

Parents
  • Hi Autchara,

    You must include the $sugar_config inside the function of your LogicHook with global:

    <?php   
        if( !defined('sugarEntry') || !sugarEntry ) die('Not A Valid Entry Point');
        class LogicHookClass {
            function logicHookFunction( $bean, $event, $arguments ) {
                global $sugar_config;
                $data = $sugar_config['data'];
                //.... do whatever with $data
            }
        }
    ?>
    

    Hope that helps,

    David.

Reply
  • Hi Autchara,

    You must include the $sugar_config inside the function of your LogicHook with global:

    <?php   
        if( !defined('sugarEntry') || !sugarEntry ) die('Not A Valid Entry Point');
        class LogicHookClass {
            function logicHookFunction( $bean, $event, $arguments ) {
                global $sugar_config;
                $data = $sugar_config['data'];
                //.... do whatever with $data
            }
        }
    ?>
    

    Hope that helps,

    David.

Children