Pārlūkot izejas kodu

Don't update description when editing events (import csv)

Don't update "color" field.

See BT#11972
jmontoyaa 8 gadi atpakaļ
vecāks
revīzija
702c470ea1
2 mainītis faili ar 32 papildinājumiem un 11 dzēšanām
  1. 3 1
      main/cron/import_csv.php
  2. 29 10
      main/inc/lib/agenda.lib.php

+ 3 - 1
main/cron/import_csv.php

@@ -986,7 +986,9 @@ class ImportCsv
                         array(), //$attachmentArray = array(),
                         [], //$attachmentCommentList
                         $eventComment,
-                        $color
+                        $color,
+                        false,
+                        false
                     );
 
                     if ($eventResult !== false) {

+ 29 - 10
main/inc/lib/agenda.lib.php

@@ -578,6 +578,7 @@ class Agenda
      * @param string $comment
      * @param string $color
      * @param bool $addAnnouncement
+     * @param bool $updateContent
      *
      * @return null|false
      */
@@ -593,7 +594,8 @@ class Agenda
         $attachmentCommentList = array(),
         $comment = null,
         $color = '',
-        $addAnnouncement = false
+        $addAnnouncement = false,
+        $updateContent = true
     ) {
         $start = api_get_utc_datetime($start);
         $end = api_get_utc_datetime($end);
@@ -607,12 +609,20 @@ class Agenda
                 }
                 $attributes = array(
                     'title' => $title,
-                    'text' => $content,
                     'date' => $start,
                     'enddate' => $end,
                     'all_day' => $allDay,
-                    'color' => $color
+
                 );
+
+                if ($updateContent) {
+                    $attributes['text'] = $content;
+                }
+
+                if (!empty($color)) {
+                    $attributes['color'] = $color;
+                }
+
                 Database::update(
                     $this->tbl_personal_agenda,
                     $attributes,
@@ -645,14 +655,20 @@ class Agenda
                 if ($this->getIsAllowedToEdit()) {
                     $attributes = array(
                         'title' => $title,
-                        'content' => $content,
                         'start_date' => $start,
                         'end_date' => $end,
                         'all_day' => $allDay,
-                        'comment' => $comment,
-                        'color' => $color
+                        'comment' => $comment
                     );
 
+                    if ($updateContent) {
+                        $attributes['content'] = $content;
+                    }
+
+                    if (!empty($color)) {
+                        $attributes['color'] = $color;
+                    }
+
                     Database::update(
                         $this->tbl_course_agenda,
                         $attributes,
@@ -850,11 +866,14 @@ class Agenda
                 if (api_is_platform_admin()) {
                     $attributes = array(
                         'title' => $title,
-                        'content' => $content,
                         'start_date' => $start,
                         'end_date' => $end,
                         'all_day' => $allDay
                     );
+
+                    if ($updateContent) {
+                        $attributes['content'] = $content;
+                    }
                     Database::update(
                         $this->tbl_global_agenda,
                         $attributes,
@@ -966,7 +985,9 @@ class Agenda
         $course_id = null,
         $groupId = null,
         $user_id = 0,
-        $format = 'json'
+        $format = 'json',
+        $startLimit = 0,
+        $endLimit = 0
     ) {
         switch ($this->type) {
             case 'admin':
@@ -1009,7 +1030,6 @@ class Agenda
             case 'personal':
             default:
                 $sessionFilterActive = false;
-
                 if (!empty($this->sessionId)) {
                     $sessionFilterActive = true;
                 }
@@ -1024,7 +1044,6 @@ class Agenda
 
                 // Getting course events
                 $my_course_list = array();
-
                 if (!api_is_anonymous()) {
                     $session_list = SessionManager::get_sessions_by_user(
                         api_get_user_id()