Results 1 to 5 of 5

Thread: Make the code for assigning notifications ????

  1. #1
    hoasuathoiroi_gh Guest

    Default Make the code for assigning notifications ????

    hi everybody,

    I want make a logic hook for assigning notification in ProjectTask module, so I created a file in "custome/module/ProjectTask/logic_hook.php" and a file in "custome/include/ProjectTask/assingning_notification.php", because I have read the toppic "how to add a logic hook ".

    So, some one can guide me to create the code in "assingning_notification.php" for assingning notification when I save a ProjectTask record?

    Many thanks!

  2. #2
    dhavaldarji's Avatar
    dhavaldarji is offline Sugar Community Member
    Join Date
    Mar 2012
    Posts
    115

    Default Re: Make the code for assigning notifications ????

    Quote Originally Posted by hoasuathoiroi_gh View Post
    hi everybody,

    I want make a logic hook for assigning notification in ProjectTask module, so I created a file in "custome/module/ProjectTask/logic_hook.php" and a file in "custome/include/ProjectTask/assingning_notification.php", because I have read the toppic "how to add a logic hook ".

    So, some one can guide me to create the code in "assingning_notification.php" for assingning notification when I save a ProjectTask record?

    Many thanks!
    Hi,

    You can use Sugar's Default assignment notification functionality to send assignment notification.
    Have a look at include/language/en_us.notify_template.html there are individual blocks for many modules and what will be sent in notification email including dynamic variable.
    You can set this variable in module's class file under set_notification_body function, (have a look at modules/Account.php).

    To make the template upgrade safe you can copy include/language/en_us.notify_template.html to custom/include/language/en_us.notify_template.html and for your projectTask you can put the code like
    Code:
    <!-- BEGIN: ProjectTask_Subject -->
    SAS Project Name: {PROJECTTASK_NAME}
    <!-- END: ProjectTask_Subject -->
    <!-- BEGIN: ProjectTask -->
    
    Project Task: {PROJECTTASK_NAME}
    Project Name : {PROJECT_NAME}
    Description: {PROJECTTASK_DESCRIPTION}
    Status: {PROJECTTASK_STATUS}
    Finish Date: {PROJECTTASK_DATE_FINISH}
    
    You may review this Project Task at:
    <{URL}>
    <!-- END: ProjectTask-->
    And then assign the dynamic variable in project task's class file :modules/ProjectTask/ProjectTask.php
    PHP Code:
    function set_notification_body($xtpl$ptask)
        {
                    global 
    $app_list_strings;
                    
    $xtpl->assign("PROJECTTASK_NAME"$ptask->name);
                    
    $xtpl->assign("PROJECT_NAME"$ptask->project_name);
                    
    $xtpl->assign("PROJECTTASK_STATUS"$ptask->status);
                    
    $xtpl->assign("PROJECTTASK_DESCRIPTION"$ptask->description);
                    
    $xtpl->assign("PROJECTTASK_DATE_FINISH"$ptask->date_finish);
                    return 
    $xtpl;
        } 
    Also make sure the user have Notify on Assignment: checked and outbound email is configure properly and Assignment Notifications: is checked under Email Optins.

    Hope this helps
    Regards,
    Dhaval Darji

  3. #3
    hoasuathoiroi_gh Guest

    Default Re: Make the code for assigning notifications ????

    Hi, thanks for yr help,

    I have follow yr guide but it does not work
    I copyed the file 'en_us.notify_template.html' in "include/language/en_us.notify_template.html" to custom/include/language/en_us.notify_template.html and add code you recommeded to file "en_us.notify_template.html".
    And add the PHP code you gave me to file "ProjectTask.php" in modules/ProjectTask/ProjectTask.php.
    I checked in email sittings, and repair & rebuilt my system
    But it's not fine
    So, could you check the code in attachments for me please?

    thanks in advance!
    Attached Files Attached Files

  4. #4
    dhavaldarji's Avatar
    dhavaldarji is offline Sugar Community Member
    Join Date
    Mar 2012
    Posts
    115

    Default Re: Make the code for assigning notifications ????

    Hi,
    The file should be en_us.notify_template.html instead of en_us.lang.php , i guess you attached wrong file.
    Couple of things to check :
    Admin -> Email Setting : configure outbound email account and test the setting by sending test email, check if mails are sent out or not.
    In the same screen Assignment Notifications: should be checked.
    Also cross check on user's profile page Notify on Assignment: is checked under advance setting.

    One more important thing to know is, it will not send assignment notification email if you are assigning the record to self, that is logged in user. so assignee and assigned user should be different.
    See these lines from modules/ProjectTask/Save.php
    PHP Code:
    $GLOBALS['check_notify'] = false;
    if (!empty(
    $_POST['assigned_user_id']) && ($project->assigned_user_id != $_POST['assigned_user_id']) && ($_POST['assigned_user_id'] != $current_user->id)) {
        
    $GLOBALS['check_notify'] = true;

    Also check SugarCRM log file for any error.

    Thanks.
    Last edited by dhavaldarji; 2013-05-16 at 11:20 AM.
    Regards,
    Dhaval Darji

  5. #5
    hoasuathoiroi_gh Guest

    Default Re: Make the code for assigning notifications ????

    Hi,
    I checked all things you commended for me, but It's not fine .
    I don't know why?
    Do your ProjectTask module in yr system work fine now? when you create a record?
    Could you check it in yr system?

    Thanks!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Opportunies Advanced Search by Accounts Post Code (Zip Code)
    By caffeineborg in forum Developer Help
    Replies: 1
    Last Post: 2012-03-16, 07:46 PM
  2. Postal Code/Zip Code formatting
    By ssxss in forum Developer Help
    Replies: 3
    Last Post: 2011-09-23, 07:35 AM
  3. Notifications
    By scrut in forum Feature Requests
    Replies: 0
    Last Post: 2009-09-18, 03:47 PM
  4. Notifications
    By mberrisford in forum Help
    Replies: 1
    Last Post: 2008-08-07, 08:37 PM
  5. Replies: 0
    Last Post: 2008-07-14, 05:40 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
  •