Browse Source

Add logs + fix condition

jmontoyaa 8 years ago
parent
commit
44330d3a33
1 changed files with 9 additions and 4 deletions
  1. 9 4
      main/cron/import_csv.php

+ 9 - 4
main/cron/import_csv.php

@@ -932,9 +932,11 @@ class ImportCsv
                     );
 
                     $item = null;
-                    foreach ($items as $tempItem) {
-                        if ($tempItem['item_id'] == $event['course_id']) {
-                            $item = $tempItem;
+                    if (!empty($items)) {
+                        foreach ($items as $tempItem) {
+                            if ($tempItem['item_id'] == $externalEventId) {
+                                $item = $tempItem;
+                            }
                         }
                     }
 
@@ -944,6 +946,10 @@ class ImportCsv
                         );
                         $update = true;
                         //continue;
+                    } else {
+                        $this->logger->addInfo(
+                            "Event #$externalEventId was not added. Preparing to be created ..."
+                        );
                     }
                 }
 
@@ -976,7 +982,6 @@ class ImportCsv
                 }
 
                 $content = '';
-
                 if ($update && isset($item['calendar_event_id'])) {
                     //the event already exists, just update
                     $eventId = $agenda->editEvent(