Browse Source

Minor - fix correct coach id + format code see BT#14971

Julio Montoya 6 years ago
parent
commit
564e8f6ec1

+ 3 - 3
main/inc/lib/ScheduledAnnouncement.php

@@ -324,7 +324,7 @@ class ScheduledAnnouncement extends Model
                     }
 
                     if ($users) {
-                        self::update(['id' => $result['id'], 'sent' => 1]);
+                        $this->update(['id' => $result['id'], 'sent' => 1]);
                         $attachments = $this->getAttachmentToString($result['id']);
                         $subject = $result['subject'];
 
@@ -371,8 +371,8 @@ class ScheduledAnnouncement extends Model
 
                             $generalCoach = '';
                             $generalCoachEmail = '';
-                            if (!empty($sessionInfo['coach_id'])) {
-                                $coachInfo = api_get_user_info($sessionInfo['coach_id']);
+                            if (!empty($sessionInfo['id_coach'])) {
+                                $coachInfo = api_get_user_info($sessionInfo['id_coach']);
                                 if (!empty($coachInfo)) {
                                     $generalCoach = $coachInfo['complete_name'];
                                     $generalCoachEmail = $coachInfo['email'];

+ 4 - 4
main/inc/lib/sessionmanager.lib.php

@@ -4171,7 +4171,9 @@ class SessionManager
         if (empty($id)) {
             return [];
         }
-        $id = intval($id);
+        $id = (int) $id;
+        $urlId = empty($urlId) ? api_get_current_access_url_id() : (int) $urlId;
+
         $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
         $tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
         $table_access_url_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
@@ -4194,8 +4196,6 @@ class SessionManager
                 ON (au.user_id = u.user_id)
                 ";
 
-        $urlId = empty($urlId) ? api_get_current_access_url_id() : (int) $urlId;
-
         if (is_numeric($status)) {
             $status = (int) $status;
             $sql .= " WHERE su.relation_type = $status AND (au.access_url_id = $urlId OR au.access_url_id is null)";
@@ -4203,7 +4203,7 @@ class SessionManager
             $sql .= " WHERE (au.access_url_id = $urlId OR au.access_url_id is null )";
         }
 
-        $sql .= " ORDER BY su.relation_type, ";
+        $sql .= ' ORDER BY su.relation_type, ';
         $sql .= api_sort_by_first_name() ? ' u.firstname, u.lastname' : '  u.lastname, u.firstname';
 
         $result = Database::query($sql);

+ 7 - 7
main/session/scheduled_announcement.php

@@ -26,25 +26,25 @@ $sessionUrl = api_get_path(WEB_CODE_PATH).'session/resume_session.php?id_session
 
 $htmlHeadXtra[] = api_get_jqgrid_js();
 $interbreadcrumb[] = [
-    'url' => "session_list.php",
-    "name" => get_lang('SessionList'),
+    'url' => 'session_list.php',
+    'name' => get_lang('SessionList'),
 ];
 $interbreadcrumb[] = [
     'url' => $sessionUrl,
-    "name" => get_lang('SessionOverview'),
+    'name' => get_lang('SessionOverview'),
 ];
 
 if ($action == 'add') {
     $interbreadcrumb[] = [
-        'url' => api_get_self()."?session_id=".$sessionId,
-        "name" => get_lang('ScheduledAnnouncements'),
+        'url' => api_get_self().'?session_id='.$sessionId,
+        'name' => get_lang('ScheduledAnnouncements'),
     ];
     $tool_name = get_lang('Add');
 } elseif ($action == 'edit') {
     $tool_name = get_lang('Edit');
     $interbreadcrumb[] = [
-        'url' => api_get_self()."?session_id=".$sessionId,
-        "name" => get_lang('ScheduledAnnouncements'),
+        'url' => api_get_self().'?session_id='.$sessionId,
+        'name' => get_lang('ScheduledAnnouncements'),
     ];
 } else {
     $tool_name = get_lang('ScheduledAnnouncements');