From 2859dc7869d49e132f434faf9cce78990dad08ba Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 17 Oct 2017 11:14:09 +0200 Subject: [PATCH] Add event/task description to invitation body (Bifrost#T51237) --- plugins/calendar/localization/en_US.inc | 2 +- .../lib/libcalendaring_itip.php | 19 ++++++++++++------- plugins/tasklist/localization/en_US.inc | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/plugins/calendar/localization/en_US.inc b/plugins/calendar/localization/en_US.inc index a640c651..b5504182 100644 --- a/plugins/calendar/localization/en_US.inc +++ b/plugins/calendar/localization/en_US.inc @@ -179,7 +179,7 @@ $labels['nextslot'] = 'Next Slot'; $labels['suggestedslot'] = 'Suggested Slot'; $labels['noslotfound'] = 'Unable to find a free time slot'; $labels['invitationsubject'] = 'You\'ve been invited to "$title"'; -$labels['invitationmailbody'] = "*\$title*\n\nWhen: \$date\n\nInvitees: \$attendees\n\nPlease find attached an iCalendar file with all the event details which you can import to your calendar application."; +$labels['invitationmailbody'] = "*\$title*\n\nWhen: \$date\n\nInvitees: \$attendees\n\n\$description\n\nPlease find attached an iCalendar file with all the event details which you can import to your calendar application."; $labels['invitationattendlinks'] = "In case your email client doesn't support iTip requests you can use the following link to either accept or decline this invitation:\n\$url"; $labels['eventupdatesubject'] = '"$title" has been updated'; $labels['eventupdatesubjectempty'] = 'An event that concerns you has been updated'; diff --git a/plugins/libcalendaring/lib/libcalendaring_itip.php b/plugins/libcalendaring/lib/libcalendaring_itip.php index 1b0788c7..b960e9a4 100644 --- a/plugins/libcalendaring/lib/libcalendaring_itip.php +++ b/plugins/libcalendaring/lib/libcalendaring_itip.php @@ -95,8 +95,9 @@ class libcalendaring_itip */ public function send_itip_message($event, $method, $recipient, $subject, $bodytext, $message = null, $rsvp = true) { - if (!$this->sender['name']) + if (!$this->sender['name']) { $this->sender['name'] = $this->sender['email']; + } if (!$message) { libcalendaring::identify_recurrence_instance($event); @@ -111,7 +112,7 @@ class libcalendaring_itip 'name' => $subject, 'vars' => array( 'title' => $event['title'], - 'name' => $this->sender['name'] + 'name' => $this->sender['name'], ) )); @@ -134,14 +135,18 @@ class libcalendaring_itip $mailbody = $this->gettext(array( 'name' => $bodytext, 'vars' => array( - 'title' => $event['title'], - 'date' => $this->lib->event_date_text($event, true) . $recurrence_info, - 'attendees' => join(",\n ", $attendees_list), - 'sender' => $this->sender['name'], - 'organizer' => $this->sender['name'], + 'title' => $event['title'], + 'date' => $this->lib->event_date_text($event, true) . $recurrence_info, + 'attendees' => join(",\n ", $attendees_list), + 'sender' => $this->sender['name'], + 'organizer' => $this->sender['name'], + 'description' => $event['description'], ) )); + // remove redundant empty lines (e.g. when an event description is empty) + $mailbody = preg_replace('/\n{3,}/', "\n\n", $mailbody); + // if (!empty($event['comment'])) { // $mailbody .= "\n\n" . $this->gettext('itipsendercomment') . $event['comment']; // } diff --git a/plugins/tasklist/localization/en_US.inc b/plugins/tasklist/localization/en_US.inc index d34f17de..6d40b10a 100644 --- a/plugins/tasklist/localization/en_US.inc +++ b/plugins/tasklist/localization/en_US.inc @@ -148,7 +148,7 @@ $labels['sendinvitations'] = 'Send invitations'; $labels['sendnotifications'] = 'Notify assignees about modifications'; $labels['sendcancellation'] = 'Notify assignees about task cancellation'; $labels['invitationsubject'] = 'You\'ve been assigned to "$title"'; -$labels['invitationmailbody'] = "*\$title*\n\nDue: \$date\n\nAssignees: \$attendees\n\nPlease find attached an iCalendar file with all the task details which you can import to your tasks application."; +$labels['invitationmailbody'] = "*\$title*\n\nDue: \$date\n\nAssignees: \$attendees\n\n\$description\n\nPlease find attached an iCalendar file with all the task details which you can import to your tasks application."; $labels['itipupdatesubject'] = '"$title" has been updated'; $labels['itipupdatesubjectempty'] = 'A task that concerns you has been updated'; $labels['itipupdatemailbody'] = "*\$title*\n\nDue: \$date\n\nAssignees: \$attendees\n\nPlease find attached an iCalendar file with the updated task details which you can import to your tasks application.";