Results 1 to 5 of 5

Thread: Logic Hook! how to merge two field contents

  1. #1
    kinshibuya's Avatar
    kinshibuya is offline A Sugar Hero
    Join Date
    Jul 2008
    Location
    brasil
    Posts
    521

    Default Logic Hooks! how to merge two field contents

    Hi! i'm using SugarCRM 5.0 f studio.

    I wnat to merge two fields contents on anothes field.
    like> nameTest (customfield) -> name + project_task_id


    I created the logik_hooks,php in <sugarcrm>/custoim/Extensions/modules/ProjectTasks/Ext/

    Code:
    <?php
     $hook_version = 1;
    $hook_array = Array();
    
    $hook_array['before_save'] = Array();
    $hook_array['before_save'][] = Array(1, 'nameTest', 'modules/ProjectTask/nameTest.php','nameTest', 'nameTest');
    
    
    ?>
    /modules/ProjectTask/nameTest.php

    Code:
    <?php
    
    require_once('data/SugarBean.php');
    require_once('modules/Contacts/Contact.php');
    require_once('include/utils.php');
    require_once('include/DetailView/DetailView.php');
    
    class nameTest {
            function nameTest(&$bean, $event, $arguments)
            {
                    if ($event == 'process_record' and $bean->fetched_row['nameTest']!= '' and $bean->fetched_row['nameTest']!= $bean->nameTest)
                    {
                            global $sugar_config;
                            $sql = 'SELECT name, project_task_id FROM project_task UNION SELECT name, project_task_id FROM project_task';
                            $result = $focus->db->query($sql);
                            $nameTest = $bean->$name.' '.$project_task_id;
                    }
            }
    }
    ?>

    But nothing happens!! is there a way to solve this one?
    Last edited by kinshibuya; 2008-09-19 at 06:22 PM.

  2. #2
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Logic Hook! how to merge two field contents

    Hi kinshibuya

    The logic_hooks.php must be saved into custom/modules/ProjectTask/logic_hooks.php

    Cheers
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  3. #3
    kinshibuya's Avatar
    kinshibuya is offline A Sugar Hero
    Join Date
    Jul 2008
    Location
    brasil
    Posts
    521

    Default Re: Logic Hook! how to merge two field contents

    Hi! ok i put the file there but still nothing happens.
    Last edited by kinshibuya; 2008-09-19 at 01:58 PM.

  4. #4
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Logic Hook! how to merge two field contents

    Hi

    Add the line

    PHP Code:
    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); 
    at the top of the file modules/ProjectTask/nameTest.php

    Cheers
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  5. #5
    kinshibuya's Avatar
    kinshibuya is offline A Sugar Hero
    Join Date
    Jul 2008
    Location
    brasil
    Posts
    521

    Default Re: Logic Hook! how to merge two field contents

    Nothing yet.
    Is the hook correct?
    is there another way to do this?


    thanks for 4 the reply!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Logic Hook - Works in custom, not in main
    By spyro187 in forum Developer Help
    Replies: 4
    Last Post: 2008-06-09, 07:19 PM
  2. Logic Hook
    By sacramentojoe in forum Help
    Replies: 15
    Last Post: 2007-07-31, 11:30 PM
  3. useful logic hook.. php newbie
    By ispytodd in forum Developer Help
    Replies: 8
    Last Post: 2006-12-28, 01:31 PM
  4. Adding Logic Hook to existing
    By Superman in forum Developer Help
    Replies: 2
    Last Post: 2006-12-18, 09:38 PM
  5. Logic Hook Question
    By swhitlow in forum Developer Help
    Replies: 1
    Last Post: 2006-06-04, 04:49 AM

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
  •