Disable Assignment Notification On Module In SugarCRM

How can I disable assignment notifications for a particular custom module in SugarCRM?

Eg. When I create a new Case or Task and assign it to a User, the User receives an email about the assignment. If I turn off "Assignment Notifications" through Email Settings > Email Options in admin panel, it turns off all notifications. But in this case I want to turn off only Task Notifications and not Case or any other.

Parents
  • Vignesh V mentioned extending the module's bean above. I made an example of how a developer might do this.

    Before considering applying any modifications to SugarBeans, I urge extreme caution. Altering existing logic in beans can have negative effects.

    I made the attached Module Loadable package that extends the Products(QLIs) module's bean to turn off assignment notifications for only this module. I achieved this by simply overriding the send_assignment_notifications method as an empty method that does nothing.

    This package contains the following to files:

    custom/modules/Products/Product.php

    <?php
    require_once('modules/Products/Product.php');
    class CustomProduct extends Product
    {
    function send_assignment_notifications($notify_user, $admin) {
    }
    }



    custom/Extension/application/Ext/Include/customProductBean.php

    <?php
    $objectList['Products'] = 'Product';
    $beanList['Products'] = 'CustomProduct';
    $beanFiles['CustomProduct'] = 'custom/modules/Products/Product.php';

    Note: Sorry for the multiple edits/alerts for this. Initially linked wrong package to response.

  • Hello

    If you are in a logic hook or so, you need to send false on the save function like this. $bean->save(false); so the notification for the $bean module is not sent.

    Otherwize, you need to alter/custom the save function of the class module itself.

    I don't know if this still working on sugar version greather than 6.x but you can alter the file <sugar>/modules/<module>/Save.php as on "modules/Quotes/Save.php" and do the same as on $focus->save($check_notify); where $check_notify is false.

    Ultimatilly, you can custom the save function on the class directly like the one used on modules/Quotes/Quote.php at the function save() and do the same as on Save.php file:

    public function save($check_notify = false)
    {
    // CL Fix for 14365. Have a default quote_type value
    if (!isset($this->quote_type) || empty($this->quote_type)) {
    $this->quote_type = 'Quotes';
    }

    return parent::save($check_notify);
    }

    Now, when you determinate wich scenario works for you, you can add the logic that you need like check if the global $current_user has checked recieve system notifications or some other logic.

    Thanks

Reply
  • Hello

    If you are in a logic hook or so, you need to send false on the save function like this. $bean->save(false); so the notification for the $bean module is not sent.

    Otherwize, you need to alter/custom the save function of the class module itself.

    I don't know if this still working on sugar version greather than 6.x but you can alter the file <sugar>/modules/<module>/Save.php as on "modules/Quotes/Save.php" and do the same as on $focus->save($check_notify); where $check_notify is false.

    Ultimatilly, you can custom the save function on the class directly like the one used on modules/Quotes/Quote.php at the function save() and do the same as on Save.php file:

    public function save($check_notify = false)
    {
    // CL Fix for 14365. Have a default quote_type value
    if (!isset($this->quote_type) || empty($this->quote_type)) {
    $this->quote_type = 'Quotes';
    }

    return parent::save($check_notify);
    }

    Now, when you determinate wich scenario works for you, you can add the logic that you need like check if the global $current_user has checked recieve system notifications or some other logic.

    Thanks

Children
No Data