Results 1 to 3 of 3

Thread: Adding Logic Hook to existing

  1. #1
    Superman's Avatar
    Superman is offline Sugar Community Member
    Join Date
    Oct 2005
    Location
    Kazakhstan
    Posts
    852

    Default Adding Logic Hook to existing

    I have developed one module with logic hook.
    But some time later i've developed another one with logic hook as well.

    And, as first module does, second module's logic hook also takes effect on the same modules.

    So this means that for example my logic hook (1st and 2nd module's) should start before saving in Calls module, and that's why custom/modules/Calls/logic_hooks.php should contain:
    PHP Code:
    $hook_array['before_save'][] = Array(1'Call_hook''modules/InvolvedEmployees/logic_hook.php''LogicHook''before_save');
    $hook_array['before_save'][] = Array(2'Call_hook''modules/PriceList/logic_hook.php''LogicHook''before_save'); 
    What is the question? When I've installed 1st module there is now question, in manifest file I wrote:
    PHP Code:
    ...
    'copy' => array( ..., 
                  array(
    'from' => '<basepath>/hooks/calls_logic_hooks.php',
                          
    'to' => 'custom/modules/Calls/logic_hooks.php',
                  ),
    ),
    ... 
    But what should I write in 2nd module's manifest file, so that logic hook ($hook_array['before_save'][] = Array(2, 'Call_hook', 'modules/PriceList/logic_hook.php', 'LogicHook', 'before_save') was appended to existing file?

  2. #2
    Superman's Avatar
    Superman is offline Sugar Community Member
    Join Date
    Oct 2005
    Location
    Kazakhstan
    Posts
    852

    Default Re: Adding Logic Hook to existing

    use post_ or pre_install files
    Farkhad Rakhimzhanov
    E-mail: farkhad@gmail.com
    Skype: rakikama

    SuperTimesheet and Invoicing — timesheet tool with invoicing for SugarCRM.
    Book time against Cases, Project Tasks and Projects.
    Create invoice regarding booked time, print it in PDF or HTML,
    customize template as you like.

  3. #3
    kbrill's Avatar
    kbrill is offline SugarCRM PS Engineer
    Join Date
    Jul 2004
    Location
    St Louis, MO
    Posts
    3,183

    Default Re: Adding Logic Hook to existing

    Check the WIKI here.


    This is an example of how to do it in a pre_install.php script.
    Code:
    <?php
    if(!defined('sugarEntry'))define('sugarEntry', true);
    function pre_install() {
    	require_once('include/utils.php');
    	check_logic_hook_file("Accounts","after_retrieve",array(1,'update_description','include/FCKEditor/updateDescription.php','updateDescription','updateDescription'));
    }
    ?>
    Kenneth Brill - Help Forum Moderator

    I do not respond to 'Private Messages'. Please email me directly instead

    When asking for help, PLEASE give us your Server Information and Version Numbers as asked for on the 'Post New Message' screen as well as any JavaScript errors shown at the bottom of the browser window.
    Help us Help You

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •