Results 1 to 5 of 5

Thread: Changing Call Color functionality (extending modules/Calls/Call.php)

  1. #1
    sequoiaben is offline Member
    Join Date
    Aug 2010
    Posts
    11

    Default Changing Call Color functionality (extending modules/Calls/Call.php)

    Hello,

    I would like to change some of the logic in modules/Calls/Call.php. However one of our project requirements is that we do not alter any core code. Therefore I'm interested in knowing what the "safe" to go about writing my custom code is.

    Here's what I'd like to accomplish:

    By default, when looking at the calls listing page, the call date is displayed in orange if the call is scheduled for the current date, and red if the call is overdue.

    Our client would like this to be changed so that the call is orange 72 hours in advance of the call.

    I can see exactly in Call.php (on line 432) where I would make my change.

    So far, I've done the following:

    - tried using various hooks, but none of them are the correct spot to hook into the code for what I want to do.
    - reviewed the Sugar docs and this forum extensively but did not find anything regarding this.

    I'm pretty new to Sugar, so maybe I'm missing something really obvious. This seems to be a pretty big topic since I imagine lots of people would want to be able to extend module base functionality.

    Maybe the solution is to write a custom Call module? ... however it seems a little overkill since all we want to do is change some color behavior.

    Thanks in advance,
    Ben

  2. #2
    sequoiaben is offline Member
    Join Date
    Aug 2010
    Posts
    11

    Default Re: Changing Call Color functionality (extending modules/Calls/Call.php)

    anyone care to reply?

  3. #3
    davidboris is offline Sugar Community Member
    Join Date
    May 2010
    Posts
    1,113

    Default Re: Changing Call Color functionality (extending modules/Calls/Call.php)

    Hello,

    Prepare a process_record logic_hook.

    PHP Code:
    class process_record
    {
        function 
    process_record(&$bean$event$arguments)
        {
            global 
    $timedate;
            
    $today gmdate($GLOBALS['timedate']->get_db_date_time_format(), time());
            
    $nextday gmdate($GLOBALS['timedate']->dbDayFormattime() + 3600*24);
            
    $mergeTime $bean->date_start//$timedate->merge_date_time($call_fields['DATE_START'], $call_fields['TIME_START']);
            
    $date_db $timedate->to_db($mergeTime);
            
    // THE CONDITIONS ARE SAME THAN SUGAR - CHANGE AS PER YOUR REQUIREMENT
            
    if( $date_db    $today){
                
    $bean->date_start"<span style='color:<OF_YOUR_CHOICE>'>".$bean->date_start."</span>";
            }else if(
    $date_db $nextday){
                
    $bean->date_start "<span style='color:<OF_YOUR_CHOICE>'>".$bean->date_start."</span>";
            }else{
                
    $bean->date_start "<span style='color:<OF_YOUR_CHOICE>'>".$bean->date_start."</span>";
            }
            
        }

    Thumbs up.

    Skype ID - david__boris

    SugarForge Projects:

    WYSIWYG now in studio!(Version 1.1 is out now!)

    Sugar Feeds on your personalized home pages like iGoogle, My Yahoo!, etc.

    Fab Tools! > Dashlet Not Followed Opportunities for past six Months

  4. #4
    sequoiaben is offline Member
    Join Date
    Aug 2010
    Posts
    11

    Default Re: Changing Call Color functionality (extending modules/Calls/Call.php)

    Excellent! That did the trick.

    Thanks so much,
    Ben

  5. #5
    rakeshray is offline Sugar Community Member
    Join Date
    Jun 2010
    Location
    Hyderabad (India)
    Posts
    313

    Default Re: Changing Call Color functionality (extending modules/Calls/Call.php)

    Quote Originally Posted by davidboris View Post
    Hello,

    Prepare a process_record logic_hook.

    PHP Code:
    class process_record
    {
        function 
    process_record(&$bean$event$arguments)
        {
            global 
    $timedate;
            
    $today gmdate($GLOBALS['timedate']->get_db_date_time_format(), time());
            
    $nextday gmdate($GLOBALS['timedate']->dbDayFormattime() + 3600*24);
            
    $mergeTime $bean->date_start//$timedate->merge_date_time($call_fields['DATE_START'], $call_fields['TIME_START']);
            
    $date_db $timedate->to_db($mergeTime);
            
    // THE CONDITIONS ARE SAME THAN SUGAR - CHANGE AS PER YOUR REQUIREMENT
            
    if( $date_db    $today){
                
    $bean->date_start"<span style='color:<OF_YOUR_CHOICE>'>".$bean->date_start."</span>";
            }else if(
    $date_db $nextday){
                
    $bean->date_start "<span style='color:<OF_YOUR_CHOICE>'>".$bean->date_start."</span>";
            }else{
                
    $bean->date_start "<span style='color:<OF_YOUR_CHOICE>'>".$bean->date_start."</span>";
            }
            
        }

    Nice post !!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Closed Calls Still Showing On Call List
    By dc50093 in forum Help
    Replies: 1
    Last Post: 2010-01-10, 05:58 AM
  2. Replies: 1
    Last Post: 2008-05-29, 04:09 PM
  3. Replies: 1
    Last Post: 2008-01-17, 09:11 PM
  4. Replies: 3
    Last Post: 2007-11-26, 07:02 AM
  5. Pro - Calls on the fly - General call/task features
    By cbierwerth in forum Feature Requests
    Replies: 1
    Last Post: 2006-06-28, 02:29 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
  •