Results 1 to 5 of 5

Thread: Logic Hook - Works in custom, not in main

  1. #1
    spyro187 is offline Sugar Community Member
    Join Date
    May 2008
    Posts
    27

    Default Logic Hook - Works in custom, not in main

    I created my first logic hook in the custom/module folder and it worked great. I decided to create an installer for my module so I built the zip and put the logic hook files in the module folder to be installed. I changed the file references and installed. The files required for the logic hook gets installed but no longer work. Do I have to do something different with logic hooks when they are in the main module dir and not the custom module dir? Do I need a post install script for some reason?

  2. #2
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,343

    Default Re: Logic Hook - Works in custom, not in main

    You can have the installer put the customer logic hook into the custom directory by just doing a copy in the manifest. You'll want to define (add) the logic hook then in the pre_install.php file

    From http://www.sugarcrm.com/wiki/index.p...l_custom_logic:
    PHP 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"));
    }

    ?>

  3. #3
    spyro187 is offline Sugar Community Member
    Join Date
    May 2008
    Posts
    27

    Default Re: Logic Hook - Works in custom, not in main

    Thank you for the information.

    If I want to have it in the main module directory, is there any reason that would not work?

    Why should I do a pre install script over a post install script?

  4. #4
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,343

    Default Re: Logic Hook - Works in custom, not in main

    Pre or Post should work just fine.

    The logic_hooks.php file must be in the custom directory. If you want your custom hook to be in the main directory just change the path to it in your hook definition:

    PHP Code:
       check_logic_hook_file("Accounts""after_retrieve", array(1"update_description",  
          
    "modules/Accounts/UpdateDescription.php""updateDescription""updateDescription")); 
    Notice that the path is modules/Accounts here. If you want it in the custom directory just add custom/ to the front of the path.

    Hope that helps!

  5. #5
    spyro187 is offline Sugar Community Member
    Join Date
    May 2008
    Posts
    27

    Default Re: Logic Hook - Works in custom, not in main

    Logic hooks have to be in the custom directory. I think that was the issue because now it works correctly.

    Thanks for all the help.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. custom logic in SugarCE 5.0.0a
    By balou in forum Developer Help
    Replies: 14
    Last Post: 2008-04-01, 11:14 PM
  2. upgraded to 4.5.1e, received "Metadata for table tracker does not exist"
    By sfgeorge in forum Installation and Upgrade Help
    Replies: 0
    Last Post: 2007-09-03, 02:24 PM
  3. useful logic hook.. php newbie
    By ispytodd in forum Developer Help
    Replies: 8
    Last Post: 2006-12-28, 01:31 PM
  4. Asterisk Patch 1.1.0 Crash on logon
    By skyracer in forum Help
    Replies: 6
    Last Post: 2006-07-08, 06:30 AM
  5. Replies: 7
    Last Post: 2006-06-06, 07:56 PM

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
  •