Results 1 to 3 of 3

Thread: How to overwrite set_notification_body()

  1. #1
    Cedric K is offline Senior Member
    Join Date
    Sep 2010
    Posts
    155

    Default How to overwrite set_notification_body()

    Hello,

    I would like to overwrite the method aCase::set_notification_body() in a safe upgrade way.
    To do that, I have created the following class in custom/modules/Cases/Cases_assigmnent.php

    PHP Code:
    require_once('modules/Cases/Case.php');

    class 
    Case_assignment extends aCase {
        function 
    Case_assignment() {
            
    parent::aCase();
        }
        
        function 
    set_notification_body($xtpl$case)
        {
            die(
    "custom");    
        }

    I call this class in custom/modules/Cases/controller.php

    PHP Code:
    class CasesController extends SugarController {

         function 
    action_editview() {
            require_once(
    'custom/modules/Cases/Case_assignment.php');
        
            
    $this->bean = new Case_assignment();//to use the overwritten method set_notification_body
            
    $this->view 'edit';
            
    $GLOBALS['view'] = $this->view;

        }

    This doesn't work. The original methiod aCase::set_notification_body is still called.
    The issue is that I don't know in which view is called the method set_notification_body() so I don't know in which action I am supposed to call my class.
    Any help please ?

    Thanks a lot
    Last edited by Cedric K; 2011-01-10 at 02:28 PM.

  2. #2
    Cedric K is offline Senior Member
    Join Date
    Sep 2010
    Posts
    155

    Default Re: How to overwrite set_notification_body()

    Any help please ?

  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: How to overwrite set_notification_body()

    Unfortunately this method can not be extended in an upgrade safe way.
    You should need to override it by yourself.
    Controller is loaded in context of DetailView, EditView or ListView of own module.
    If you save the Cases through Quick Create subpanel under Accounts or by Inbound Email so it will never be called.

    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.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. One more MVC overwrite question
    By alearr in forum Developer Help
    Replies: 1
    Last Post: 2008-05-15, 10:35 AM
  2. More MVC overwrite questions
    By marketadvantage in forum Developer Help
    Replies: 2
    Last Post: 2008-05-01, 03:35 PM
  3. MVC overwrite question
    By marketadvantage in forum Developer Help
    Replies: 12
    Last Post: 2008-04-30, 06:54 PM
  4. Import and Overwrite
    By neilt in forum Feature Requests
    Replies: 0
    Last Post: 2007-06-16, 02:50 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
  •