Add authorId to avoid errors when calling from import_csv.php CLI

pull/2487/head
jmontoyaa 9 years ago
parent 0394fc31a2
commit ee25dc43fb
  1. 7
      main/cron/import_csv.php
  2. 11
      main/inc/lib/agenda.lib.php

@ -1160,7 +1160,7 @@ class ImportCsv
} else {
$report['mail_not_sent_announcement_exists']++;
$this->logger->addInfo(
"Mail NOT sent. An announcement seems to be already saved in $info"
"Mail NOT sent. An announcement seems to be already saved in '$info'"
);
}
} else {
@ -1168,7 +1168,6 @@ class ImportCsv
$report['mail_not_sent_because_date']++;
}
}
$content = '';
if ($update && isset($item['item_id'])) {
//the event already exists, just update
@ -1185,7 +1184,8 @@ class ImportCsv
$eventComment,
$color,
false,
false
false,
$this->defaultAdminId
);
if ($eventResult !== false) {
@ -1215,7 +1215,6 @@ class ImportCsv
);
if (!empty($eventId)) {
//$extraFieldValue->is_course_model = true;
$extraFieldValue->save(
array(
'value' => $externalEventId,

@ -675,6 +675,7 @@ class Agenda
* @param string $color
* @param bool $addAnnouncement
* @param bool $updateContent
* @param int $authorId
*
* @return null|false
*/
@ -691,11 +692,13 @@ class Agenda
$comment = null,
$color = '',
$addAnnouncement = false,
$updateContent = true
$updateContent = true,
$authorId = 0
) {
$start = api_get_utc_datetime($start);
$end = api_get_utc_datetime($end);
$allDay = isset($allDay) && $allDay == 'true' ? 1 : 0;
$authorId = empty($authorId) ? api_get_user_id() : (int) $authorId;
switch ($this->type) {
case 'personal':
@ -846,7 +849,7 @@ class Agenda
TOOL_CALENDAR_EVENT,
$id,
'visible',
api_get_user_id(),
$authorId,
$groupIid,
null,
$start,
@ -882,7 +885,7 @@ class Agenda
TOOL_CALENDAR_EVENT,
$id,
'visible',
api_get_user_id(),
$authorId,
$groupIidItem,
0,
$start,
@ -924,7 +927,7 @@ class Agenda
TOOL_CALENDAR_EVENT,
$id,
'visible',
api_get_user_id(),
$authorId,
$groupIid,
$userId,
$start,

Loading…
Cancel
Save