Results 1 to 8 of 8

Thread: SugarFeeds - Ohter modules

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

    Default SugarFeeds - Ohter modules

    Is there a way to add other modules to SugarFeeds?

  2. #2
    matthew's Avatar
    matthew is offline Sugar Team Member
    Join Date
    Jul 2005
    Posts
    533

    Default Re: SugarFeeds - Ohter modules

    In the code, yes.

    You can create a logic hook for whatever module that you want. When it's saving the record to the database, you can instantiate the SugarFeed Object (./modules/SugarFeed/SugarFeed.php) and pass in whatever message you want to post about that module in question

    You can learn more about logic hooks here:

    http://developers.sugarcrm.com/docs/...uide.1.92.html

    Sugar University for training
    Sugar Wiki for developer and user help
    SugarForge for modules, themes, lang packs
    SugarExchange for production-ready extensions
    Enter/view bugs via the Sugar bug tracker

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

    Default Re: SugarFeeds - Ohter modules

    Hi! thanks for the reply. I found the logic hook for cases and i'll try to do one with projectTasks. If i have any doubts ill post it here!
    Last edited by kinshibuya; 2011-01-10 at 06:42 PM.

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

    Talking Re: SugarFeeds - Ohter modules

    Hi!
    It worked! I added module ProjectTask.

    On /sugarcrm/custom/modules/ProjectTask/logic_hooks.php (create this file)

    PHP Code:
    <?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'ProjectTask push feed''modules/ProjectTask/SugarFeeds/ProjectTaskFeed.php','ProjectTaskFeed''pushFeed'); 

    ?>
    On /sugarcrm/modules/ProjectTask/SugarFeeds/ProjectTaskFeed.php (create this file too)

    PHP Code:
    <?php
    require_once('modules/SugarFeed/feedLogicBase.php');
    require_once(
    'modules/SugarFeed/SugarFeed.php');

    class 
    ProjectTaskFeed extends FeedLogicBase{
        var 
    $module 'ProjectTask';
        function 
    pushFeed($bean$event$arguments){
            
    $text '';
            if(empty(
    $bean->fetched_row)){
                
    $text =  '{SugarFeed.CREATED_PROJECTTASK} [' $bean->module_dir ':' $bean->id ':' $bean->name ' ' $bean->percent_complete ']';
            }else{
                if(!empty(
    $bean->fetched_row['percent_complete'] ) && $bean->fetched_row['percent_complete'] != $bean->status && $bean->status != '1'){
                    
    $text =  '{SugarFeed.ALTERED_PROJECTTASK} [' $bean->module_dir ':' $bean->id ':' $bean->name'] {SugarFeed.FOR_PROJECTTASK} [' $bean->module_dir ':' $bean->id ':' $bean->percent_complete ']';
                }
            }
            
            if(!empty(
    $text)){ 
                
    SugarFeed::pushFeed($text$bean->module_dir$bean->id



                                    
    ,$bean->assigned_user_id
                    
    );
            }
            
        }
    }
    ?>
    Then i've repair/rebuild and set the language on /modules/SugarFeed/language
    After that i enabled the module on Admin -> Configure Sugar Feeds

    Thanks for the help!
    Last edited by kinshibuya; 2011-01-10 at 06:43 PM.

  5. #5
    dekleinemedia is offline A Prolific Poster
    Join Date
    May 2009
    Location
    Netherlands
    Posts
    241

    Default Re: SugarFeeds - Ohter modules

    Hi,

    This is a very useful add-on. I also created different logic_hooks for modules Projects, ProjectTasks, Calls etc.

    Only I have a question;
    I have set the 'My Feed Dashlet' on my homepage. Now I want all data that is created AND/OR modified by a user (like data in Projects, ProjectTasks, Calls etc.) to show up in my 'My Feed Dashlet' ...?

    Now only thing that can be done is to show up data in 'My Feed Dashlet' when I create a Lead, Oppurtunity, Case or Contact. I have added some Feeds and I want these feeds to show all created AND modified data.

    See screenshot

    How can I do this? Hope someone can help me with this. Thanks in advance
    Attached Images Attached Images  
    Kind regards,

    De Kleine Media


    SugarCRM CE v.5.2.0h
    Windows platform
    MySQL v.5.1
    phpMyAdmin - 2.11.2.2
    Apache Server v.2.0

  6. #6
    dekleinemedia is offline A Prolific Poster
    Join Date
    May 2009
    Location
    Netherlands
    Posts
    241

    Default Re: SugarFeeds - Ohter modules

    Hi,

    Can someone tell me if this is possible? If so please let me know how to do it. Thankss
    Kind regards,

    De Kleine Media


    SugarCRM CE v.5.2.0h
    Windows platform
    MySQL v.5.1
    phpMyAdmin - 2.11.2.2
    Apache Server v.2.0

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

    Default Re: SugarFeeds - Ohter modules

    Hi! The definitions of when a record is displayed in sugar feeds goes on the file
    /modules/Cases/SugarFeeds/CaseFeed.php
    Code:
    require_once('modules/SugarFeed/feedLogicBase.php');
    require_once('modules/SugarFeed/SugarFeed.php');
    
    class CaseFeed extends FeedLogicBase {
        var $module = 'Cases';
        function pushFeed($bean, $event, $arguments){
            $text = '';
            if(empty($bean->fetched_row)){
                $text =  '{SugarFeed.CREATED_CASE} [' . $bean->module_dir . ':' . $bean->id . ':' . $bean->name.'] {SugarFeed.FOR_CASE} [Accounts:' . $bean->account_id . ':' . $bean->account_name . ']<br>'. $bean->description;
            }else{
                if(!empty($bean->fetched_row['status'] ) && $bean->fetched_row['status'] != $bean->status && $bean->status == 'Closed'){ //in my case it will only go to feed if someone changes the status 
                    $text =  '{SugarFeed.CLOSED_CASE} [' . $bean->module_dir . ':' . $bean->id . ':' . $bean->name. '] {SugarFeed.FOR_CASE} [Accounts:' . $bean->account_id . ':' . $bean->account_name . ']';
                }
            }
    		
            if(!empty($text)){ 
                SugarFeed::pushFeed($text, $bean->module_dir, $bean->id 
    
    
    
    								,$bean->assigned_user_id
                    );
            }
    		
        }
    }
    The code for every changes would be this one:

    Code:
    require_once('modules/SugarFeed/feedLogicBase.php');
    require_once('modules/SugarFeed/SugarFeed.php');
    
    class CaseFeed extends FeedLogicBase {
        var $module = 'Cases';
        function pushFeed($bean, $event, $arguments){
            $text = '';
            if(empty($bean->fetched_row)){
                $text =  '{SugarFeed.CREATED_CASE} [' . $bean->module_dir . ':' . $bean->id . ':' . $bean->name.'] {SugarFeed.FOR_CASE} [Accounts:' . $bean->account_id . ':' . $bean->account_name . ']<br>'. $bean->description;
            }else{
               // if(!empty($bean->fetched_row['status'] ) && $bean->fetched_row['status'] != $bean->status && $bean->status == 'Closed'){
                    $text =  '{SugarFeed.CLOSED_CASE} [' . $bean->module_dir . ':' . $bean->id . ':' . $bean->name. '] {SugarFeed.FOR_CASE} [Accounts:' . $bean->account_id . ':' . $bean->account_name . ']';
                //}
            }
    		
            if(!empty($text)){ 
                SugarFeed::pushFeed($text, $bean->module_dir, $bean->id 
    
    
    
    								,$bean->assigned_user_id
                    );
            }
    		
        }
    }
    In admin sugar feeds you must mark all modules,
    and you mus edit the my feeds dashlet and choose the option all modules
    Priscila Kin Yamamoto Joranhezon
    Phone: +55 61 32010000
    priscila.joranhezon@nct.com.br
    NCT Informática Ltda

  8. #8
    davingreen is offline Member
    Join Date
    Jan 2010
    Posts
    19

    Default Re: SugarFeeds - Ohter modules

    I'm having trouble getting this add-on to work for custom modules. Created the following files, rebuilt/repaired, and added in admin settings without error, but now records are not being put into the database when saved. Any ideas as to what I'm doing wrong? Does something different need to be done for Custom modules?

    /crm/custom/modules/green_Proposals/logic_hooks.php
    Code:
    <?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, 'green_Proposals push feed', 'modules/green_Proposals/SugarFeeds/green_ProposalsFeed.php','green_ProposalsFeed', 'pushFeed'); 
    
    ?>
    /crm/modules/green_Proposals/SugarFeeds/green_ProposalsFeed.php
    Code:
    <?php
    require_once('modules/SugarFeed/feedLogicBase.php');
    require_once('modules/SugarFeed/SugarFeed.php');
    
    class green_ProposalsFeed extends FeedLogicBase{
        var $module = 'green_Proposals';
        function pushFeed($bean, $event, $arguments){
            $text = '';
            if(empty($bean->fetched_row)){
                $text =  '{SugarFeed.CREATED_green_Proposals} [' . $bean->module_dir . ':' . $bean->id . ':' . $bean->name . ' ' . $bean->percent_complete . ']';
            }else{
                if(!empty($bean->fetched_row['percent_complete'] ) && $bean->fetched_row['percent_complete'] != $bean->status && $bean->status != '1'){
                    $text =  '{SugarFeed.ALTERED_green_Proposals} [' . $bean->module_dir . ':' . $bean->id . ':' . $bean->name. '] {SugarFeed.FOR_green_Proposals} [' . $bean->module_dir . ':' . $bean->id . ':' . $bean->percent_complete . ']';
                }
            }
    		
            if(!empty($text)){ 
                SugarFeed::pushFeed($text, $bean->module_dir, $bean->id
    
    
    
    								,$bean->assigned_user_id
                    );
            }
    		
        }
    }
    ?>
    Last edited by davingreen; 2010-08-04 at 04:16 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 2009-04-02, 07:42 PM
  2. Modules getting deleted from modules folder?
    By hiko in forum Developer Help
    Replies: 1
    Last Post: 2009-01-16, 08:10 AM
  3. Expose RSS or ATOM feed from SugarFeeds
    By nicholsr in forum General Discussion
    Replies: 0
    Last Post: 2009-01-12, 06:06 PM
  4. Why new modules not shown in the Role modules list
    By j.lagos in forum Developer Help
    Replies: 1
    Last Post: 2008-09-22, 12:54 PM
  5. modules for 4.0.1d?
    By kickn in forum Downloads
    Replies: 0
    Last Post: 2006-03-17, 07:48 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
  •