Project

General

Profile

Bug #6997

Agenda event to "everyone" problems in mail and not showed in Announcements (1.9.x)

Added by Irene Rengel over 5 years ago. Updated over 5 years ago.

Status:
Bug resolved
Priority:
High
Category:
-
Target version:
Start date:
06/03/2014
Due date:
% Done:

100%

Estimated time:
Complexity:
Normal
SCRUM pts - complexity:
?

Description

Hello,
In Chamilo 1.9.x when you creat a new event in Agenda to "Everyone" and checks the option "Add as an announcement (Send email)":

1. the mail that Chamilo sends to users doesnt have the subject/title neither the body/description.
2. the annuncement is not added to the Annonucements tool

However, both issues works alright if you creates an event just for one student: sends the mail correctly and also you can see the announcemnt on the announcement tool.

Many thanks

History

#1

Updated by Julio Montoya over 5 years ago

  • Status changed from New to Assigned
  • Assignee set to Yoselyn Castillo

Hi Yoselyn,
Could you check this one? Maybe try it in stable.chamilo.org

#2

Updated by Adolfo Igualada Martínez over 5 years ago

Hi, this problem happens in this part o code in announcements.inc.php in function add_announcement:

            // store in item_property (first the groups, then the users
            if (!is_null($sent_to)) { //Adolfo : $sent_to never is null
                // !is_null($sent_to): when no user is selected we send it to everyone
                $send_to = self::separate_users_groups($sent_to);
                // storing the selected groups
                if (is_array($send_to['groups'])) {
                    foreach ($send_to['groups'] as $group) {
                        api_item_property_update($_course, TOOL_ANNOUNCEMENT, $last_id, "AnnouncementAdded", api_get_user_id(), $group);
                    }
                }

                // storing the selected users
                if (is_array($send_to['users'])) {
                    foreach ($send_to['users'] as $user) {
                        api_item_property_update($_course, TOOL_ANNOUNCEMENT, $last_id, "AnnouncementAdded", api_get_user_id(), '', $user);
                    }
                }
            } else { //Adolfo :Here never enters
                // the message is sent to everyone, so we set the group to 0
                api_item_property_update($_course, TOOL_ANNOUNCEMENT, $last_id, "AnnouncementAdded", api_get_user_id(), '0');
            }

In else never enters because sent_to never is null.
The solution that i propose is this one :

 // store in item_property (first the groups, then the users
            if (!is_null($sent_to) && $sent_to[0] != 'everyone') { //Adolfo: In this if i am checking if sent_to[0] it's not 'everyone'
                // !is_null($sent_to): when no user is selected we send it to everyone
                $send_to = self::separate_users_groups($sent_to);
                // storing the selected groups
                if (is_array($send_to['groups'])) {
                    foreach ($send_to['groups'] as $group) {
                        api_item_property_update($_course, TOOL_ANNOUNCEMENT, $last_id, "AnnouncementAdded", api_get_user_id(), $group);
                    }
                }

                // storing the selected users
                if (is_array($send_to['users'])) {
                    foreach ($send_to['users'] as $user) {
                        api_item_property_update($_course, TOOL_ANNOUNCEMENT, $last_id, "AnnouncementAdded", api_get_user_id(), '', $user);
                    }
                }
            } else { //Adolfo: Now when $sent_to is equals everyone enters here.
                // the message is sent to everyone, so we set the group to 0
                api_item_property_update($_course, TOOL_ANNOUNCEMENT, $last_id, "AnnouncementAdded", api_get_user_id(), '0');
            }


I tested this code with the different ways to create events as annoucements in agenda (everyone, groups, users) works fine.

Saludos.

#3

Updated by Yoselyn Castillo over 5 years ago

  • % Done changed from 0 to 70

I had detected this issue and it is solved with the pull request proposed for issue #6926 in
https://github.com/ycastillo/chamilo-lms/commit/16fea06ca88dfaf5066b0573903691646872e98c
Please try it
The solution proposed by Adolfo works too.

#4

Updated by Adolfo Igualada Martínez over 5 years ago

Thank you, tested and works fine.

#5

Updated by Julio Montoya over 5 years ago

  • Status changed from Assigned to Needs testing

I just sent a fix for this.

#6

Updated by Yoselyn Castillo over 5 years ago

  • Status changed from Needs testing to Bug resolved
  • % Done changed from 70 to 100

Good, When we add an event (adding as announcement) it is correctly shown in agenda for ¨everyone¨ or specific user. It is added in announcements tool.
So we can close this.

Also available in: Atom PDF