Browse Source

Fix delete announcement see BT#13602

jmontoyaa 7 years ago
parent
commit
562085fb4d
1 changed files with 14 additions and 18 deletions
  1. 14 18
      main/inc/ajax/announcement.ajax.php

+ 14 - 18
main/inc/ajax/announcement.ajax.php

@@ -34,28 +34,24 @@ switch ($action) {
             }
 
             $list = explode(',', $_REQUEST['id']);
-
             foreach ($list as $itemId) {
-                if (!api_is_session_general_coach() ||
-                    api_is_element_in_the_session(TOOL_ANNOUNCEMENT, $itemId)
-                ) {
-                    if (!empty($groupId)) {
-                        $result = AnnouncementManager::get_by_id(
-                            api_get_course_int_id(),
-                            $itemId
-                        );
-                        if (!empty($result)) {
-                            $delete = true;
-                            if (!empty($groupId) && $isTutor) {
-                                if ($groupId != $result['to_group_id']) {
-                                    $delete = false;
-                                }
-                            }
-                            if ($delete) {
-                                AnnouncementManager::delete_announcement($courseInfo, $itemId);
+                if (!api_is_session_general_coach() || api_is_element_in_the_session(TOOL_ANNOUNCEMENT, $itemId)) {
+                    $result = AnnouncementManager::get_by_id(
+                        api_get_course_int_id(),
+                        $itemId
+                    );
+                    if (!empty($result)) {
+                        $delete = true;
+                        if (!empty($groupId) && $isTutor) {
+                            if ($groupId != $result['to_group_id']) {
+                                $delete = false;
                             }
                         }
+                        if ($delete) {
+                            AnnouncementManager::delete_announcement($courseInfo, $itemId);
+                        }
                     }
+
                 }
             }
         }