|
@@ -2,6 +2,7 @@
|
|
|
/* For licensing terms, see /license.txt */
|
|
|
|
|
|
use Chamilo\CourseBundle\Entity\CCalendarEvent;
|
|
|
+use Chamilo\CourseBundle\Entity\CItemProperty;
|
|
|
|
|
|
if (PHP_SAPI != 'cli') {
|
|
|
die('Run this script through the command line or comment this line in the code');
|
|
@@ -15,7 +16,6 @@ require_once __DIR__.'/../inc/global.inc.php';
|
|
|
|
|
|
ini_set('memory_limit', -1);
|
|
|
ini_set('max_execution_time', 0);
|
|
|
-ini_set('display_errors', '1');
|
|
|
ini_set('log_errors', '1');
|
|
|
error_reporting(-1);
|
|
|
|
|
@@ -966,11 +966,24 @@ class ImportCsv
|
|
|
if ($calendarEvent) {
|
|
|
$this->logger->addInfo('Calendar event found '.$item['item_id']);
|
|
|
if ($calendarEvent->getCId() != $courseInfo['real_id']) {
|
|
|
- $this->logger->addInfo('Move from course #'.$courseInfo['real_id'].' to #'.$calendarEvent->getCId());
|
|
|
+ $this->logger->addInfo('Move from course #'.$calendarEvent->getCId().' to #'.$courseInfo['real_id']);
|
|
|
// Seems that the course id changed in the csv
|
|
|
$calendarEvent->setCId($courseInfo['real_id']);
|
|
|
$em->persist($calendarEvent);
|
|
|
$em->flush();
|
|
|
+
|
|
|
+ $criteria = [
|
|
|
+ 'tool' => 'calendar_event',
|
|
|
+ 'ref' => $item['item_id']
|
|
|
+ ];
|
|
|
+ /** @var CItemProperty $itemProperty */
|
|
|
+ $itemProperty = $em->getRepository('ChamiloCourseBundle:CItemProperty')->findOneBy($criteria);
|
|
|
+ if ($itemProperty) {
|
|
|
+ $courseEntity = $em->getRepository('ChamiloCourseBundle:Course')->find($courseInfo['real_id']);
|
|
|
+ $itemProperty->setCourse($courseEntity);
|
|
|
+ $em->persist($itemProperty);
|
|
|
+ $em->flush();
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
$this->logger->addInfo('Calendar event not found '.$item['item_id']);
|