Results 1 to 5 of 5

Thread: Save button after logic hook

  1. #1
    pj504a is offline Junior Member
    Join Date
    Nov 2011
    Posts
    3

    Default Save button after logic hook

    Hi, I wonder if anyone else has had the same issue:

    I have created a before save logic hook for leads which creates a custom record, then the logic hook kicks in for the custom record and creates a custom record of another type. Or at least that's the intention.

    The problem I have had is after saving the lead for the first time I am then unable to save the lead again. Once I take the logic hooks away - and create a fresh lead without the hooks it saves OK any number of times. So the logic hooks are somehow interfering with the functionality of the save button, despite the fact that the logic hooks seem to work OK.

    I am using version 6.3 - seems to happen in all browsers.

    Any help on this subject would be greatly appreciated....

  2. #2
    jmertic is offline Sugar Community Manager
    Join Date
    Dec 2007
    Posts
    2,224

    Default Re: Save button after logic hook

    Can you show your logic hook code, and also let us know what errors you are getting on subsequent saves?
    John Mertic
    Sugar Community Manager

  3. #3
    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: Save button after logic hook

    Let us know the logic_hooks.php and your logic hook classes.

    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.

  4. #4
    pj504a is offline Junior Member
    Join Date
    Nov 2011
    Posts
    3

    Default Re: Save button after logic hook

    Hi This is the logic_hooks.php file - I have just noticed an issue with it but don't think it's what is causing the save button problem:

    <?php
    // Do not store anything in this file that is not part of the array or the hook version. This file will
    // be automatically rebuilt in the future.
    $hook_version = 1;
    $hook_array = Array();
    // position, file, function
    $hook_array['before_save'] = Array();
    $hook_array['before_save'][] = Array(1, 'Leads push feed', 'modules/Leads/SugarFeeds/LeadFeed.php','LeadFeed', 'pushFeed');
    $hook_array['before_save'][] = Array(1, 'Relate and Create', 'custom/modules/Leads/relating.php','leads_relatingmodule', 'leads_relating');
    $hook_array['after_ui_frame'] = Array();
    $hook_array['after_ui_frame'][] = Array(1, 'Leads InsideView frame', 'modules/Connectors/connectors/sources/ext/rest/insideview/InsideViewLogicHook.php','InsideViewLogicHook', 'showFrame');
    ?>

    then the class file for leads:

    <?php
    class leads_relatingmodule {
    function leads_relating(&$bean, $event, $arguments)
    {
    switch($bean->create_project_c)
    {
    case "Yes":
    if($bean->project_created_c == "No")
    {
    $bean->project_created_c = "Yes";
    $apfs_project->project_type = $bean->sample_type_c;
    $apfs_project->confirmed_date = date('Y-m-d');
    $apfs_project->project_year_c = $bean->project_year_c;
    $apfs_project->save();
    } //ENDIF
    }//ENDIF
    break;
    }//END SWITCH
    } //END FUNCTION
    }
    ?>

    this all works ok..........will continue in another post........

  5. #5
    pj504a is offline Junior Member
    Join Date
    Nov 2011
    Posts
    3

    Default Re: Save button after logic hook

    The logic_hook.php file for the $apfs_project module:

    <?php
    $hook_version = 1;
    $hook_array = Array();
    $hook_array['before_save'][] = Array(1, 'ChangeOnSave', 'custom/modules/APFS_Projects/relating.php', 'projects_relatingmodule', 'relating');
    ?>

    then the class file:

    <?php

    class projects_relatingmodule {
    function relating(&$bean, $event, $arguments)
    {
    if($_REQUEST['module'] == 'APFS_Projects')
    {


    }
    elseif($_REQUEST['module'] == 'Leads')
    {
    switch($_REQUEST['sample_type_c'])
    {
    case 'CCP':
    $prod_mod = 'CCP_Production';
    $prod_php = 'CCP_Production';
    $data_mod = 'pdata_CCP_Pricing';
    $data_php= 'pdata_CCP_Pricing';
    break;
    case 'CAL':
    $prod_mod = 'CAL_Production';
    $prod_php = 'CAL_Production';
    $data_mod = 'pdata_CAL_Pricing';
    $data_php= 'pdata_CAL_Pricing';
    break;
    }

    require_once('modules/'.$prod_mod.'/'.$prod_php.'.php');
    require_once('modules/'.$data_mod.'/'.$data_mod.'.php');
    //eval('$this_prod_mod = new '.$prod_mod.'();');
    // $this_prod_mod->save();
    }
    }
    }
    ?>


    It is the saving of $this_prod_mod that causes the leads save button to become unresponsive but only on the edit view of the record that created a new apfs_project. If I comment out this line - I don't have a problem. What I am tryng to do is create a series of records of different types and link them all together in one hit.

    Thanks in advance for your help on this much appreciated!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. After Save logic hook?
    By Krissy-D in forum Developer Help
    Replies: 2
    Last Post: 2011-02-06, 08:42 PM
  2. After Save Logic Hook
    By thamim in forum Developer Help
    Replies: 0
    Last Post: 2010-08-12, 09:49 PM
  3. Replies: 0
    Last Post: 2009-03-30, 06:15 PM
  4. save & skip logic hook
    By mikesolomon in forum Developer Help
    Replies: 2
    Last Post: 2008-11-05, 12:59 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
  •