Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: Create/Edit logic hooks from Admin

  1. #1
    mvngti is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    South Africa
    Posts
    510

    Default Create/Edit logic hooks from Admin

    I created an action that can help users create or edit logic hooks from within the SugarCRM UI. (admin)

    I see a lot of advice here along the lines of "create a logic hook that does..." but hardly ever detail on how to actually create it. Now I know they can go and read up in the docs but I thought a small module that can create the hooks and they just paste the code in there could be a good idea for newbies.

    Before I package this into a proper module I would like some feedback on the idea and the attached file please.
    Just drop the file in custom/modules/Administration and then open index.php?module=Administration&action=editLogicHo oks
    Attached Files Attached Files
    --


    Marnus van Niekerk

    There are only 10 types of people in the world
    those who can read binary and those who don't

    Modules:
    CE Teams - Upgrade safe teams module for Community Edition
    FieldACL - Field Level Access Control for Community Edition
    EditLogicHooks - Create and edit Logic Hooks from the Admin GUI
    FlexibleChartDashlet - Display any data in a Dashlet Chart
    DocumentThumbnails - Thumbnails for Documents module

    Many questions can be answered by reading the Developers Manual

  2. #2
    lordforbes is offline Sugar Community Member
    Join Date
    Aug 2006
    Posts
    36

    Default Re: Create/Edit logic hooks from Admin

    Looks great - thanks ... I've just tried it with a logic hook submitted on another thread ... IIt threw out some php5 commands (specifically CONST)

    Are you using php4 to validate the code inside the comments?? Any chance this could be updated to php5?

  3. #3
    genius786's Avatar
    genius786 is offline Sugar Community Member
    Join Date
    Nov 2008
    Location
    Karachi, Pakistan
    Posts
    129

    Smile Re: Create/Edit logic hooks from Admin

    Hi,

    Interesting work and it will definitely help the new developer of sugarcrm.

    My suggestion for improvised is:

    Add more code in LOGIC like (before_save check it is 'admin' or not )



    Best regards,
    SARFARAZ AHMED KHAN
    Karachi, Pakistan
    skype: genius_crystal
    genius_crystal@hotmail.com
    92-314-2595624

  4. #4
    mvngti is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    South Africa
    Posts
    510

    Default Re: Create/Edit logic hooks from Admin

    Quote Originally Posted by lordforbes View Post
    Are you using php4 to validate the code inside the comments?? Any chance this could be updated to php5?
    The code in the logic hook is validated by actually including it in the current script so it is validated by whatever version of php your SugarCRM is running on (which must be php5).

    If you post the code I can check it.
    --


    Marnus van Niekerk

    There are only 10 types of people in the world
    those who can read binary and those who don't

    Modules:
    CE Teams - Upgrade safe teams module for Community Edition
    FieldACL - Field Level Access Control for Community Edition
    EditLogicHooks - Create and edit Logic Hooks from the Admin GUI
    FlexibleChartDashlet - Display any data in a Dashlet Chart
    DocumentThumbnails - Thumbnails for Documents module

    Many questions can be answered by reading the Developers Manual

  5. #5
    lordforbes is offline Sugar Community Member
    Join Date
    Aug 2006
    Posts
    36

    Default Re: Create/Edit logic hooks from Admin

    Actually this code was lifted from another forum available here
    http://www.sugarcrm.com/forums/showt..._code_hook.php

    It basically adds a sequence number function to leads (or any other module) ... I have to admit I didn't add this code natively so for all I know the code may be faulty ... but effectively the parser seem to throw out the CONST lines...

    Try it and see..

  6. #6
    mvngti is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    South Africa
    Posts
    510

    Default Re: Create/Edit logic hooks from Admin

    What you did was to paste all of the code from a working logic hook file into the method part of my editor.

    Mine is designed to help guys build the file and they just need to add the content of the method (which is what they get mostly on the forums).

    You can not have CONST lines inside the method. If you want to use this code in my editor you have to paste the CONST lines BEFORE the function line and the contents of the function between the two comments.

    M
    --


    Marnus van Niekerk

    There are only 10 types of people in the world
    those who can read binary and those who don't

    Modules:
    CE Teams - Upgrade safe teams module for Community Edition
    FieldACL - Field Level Access Control for Community Edition
    EditLogicHooks - Create and edit Logic Hooks from the Admin GUI
    FlexibleChartDashlet - Display any data in a Dashlet Chart
    DocumentThumbnails - Thumbnails for Documents module

    Many questions can be answered by reading the Developers Manual

  7. #7
    lordforbes is offline Sugar Community Member
    Join Date
    Aug 2006
    Posts
    36

    Default Re: Create/Edit logic hooks from Admin

    Ah - thanks for that - you can obviously tell I'm no PHP programmer..... exactly why I need a utility like this!

    I'll try it again as suggested!

  8. #8
    mvngti is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    South Africa
    Posts
    510

    Exclamation Re: Create/Edit logic hooks from Admin

    I have now made this into an installable module that will add a "Logic Hooks" section to the admin panel.

    You can use this module to create, install and edit logic hooks for any or all modules for you. All you need to do is to add the code inside the actual hook method. I built this because I often see advice on the forum along the lines of "build a logic hook that does...." but hardly ever how to actually build it.

    Using this module you do not need to understand how to build and install the logic hooks, just the code inside it or just copy and paste the code without understanding it :-)

    Module attached

    M
    Attached Files Attached Files
    --


    Marnus van Niekerk

    There are only 10 types of people in the world
    those who can read binary and those who don't

    Modules:
    CE Teams - Upgrade safe teams module for Community Edition
    FieldACL - Field Level Access Control for Community Edition
    EditLogicHooks - Create and edit Logic Hooks from the Admin GUI
    FlexibleChartDashlet - Display any data in a Dashlet Chart
    DocumentThumbnails - Thumbnails for Documents module

    Many questions can be answered by reading the Developers Manual

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

    Default Re: Create/Edit logic hooks from Admin

    Great stuff! Keep it up.

  10. #10
    lordforbes is offline Sugar Community Member
    Join Date
    Aug 2006
    Posts
    36

    Default Re: Create/Edit logic hooks from Admin

    Great stuff ... just one observation ... I've renamed my tab CASES to MATTERS. As you know that only renames the TAB, it doesn't create or rename the directory.

    However when I use the administration module to create a logic hook module for it, it seems to work OK but it actually copies the hook to /matters/logic_hooks.php instead of /cases/logic_hooks.php ... (i.e. it CREATES the MATTERS directory)...

    As a result it my hook didn't work until I manually copied it across from the Matters to the Cases directory. I'm sure its a simple fix but as you can see from my earlier posts I'm n not clever enough to change the code!

Page 1 of 3 123 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Logic Hooks Needed
    By kbrill in forum Developer Help
    Replies: 14
    Last Post: 2009-06-18, 10:04 AM
  2. Logic Hooks for Relationships?
    By dorphalsig in forum Developer Help
    Replies: 14
    Last Post: 2009-04-01, 10:12 AM
  3. Logic Hooks
    By Delos in forum Developer Help
    Replies: 0
    Last Post: 2008-10-17, 01:01 AM
  4. logic hooks
    By user1000 in forum Developer Help
    Replies: 3
    Last Post: 2008-05-06, 07:51 AM
  5. Workflow -- Logic Hooks
    By robert.blasingame in forum Help
    Replies: 1
    Last Post: 2008-03-11, 10:57 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
  •