meeting-room-booking-system / mrbs-code

MRBS application code
Other
120 stars 59 forks source link

include iCalendar details at edit_entry as an option #2613

Open jberanek opened 4 years ago

jberanek commented 4 years ago

Hi, is it possible we add icalendar option (yes/no) as a custom field at edit_entry page? This will give option to the booker to include email notification together with icalendar details or not.

instead of this config true or false set by admin

$mail_settings['icalendar'] = false; // Set to true to include iCalendar details

Into something like this?

Thank you..

Reported by: *anonymous

Original Ticket: mrbs/support-requests/1918

jberanek commented 4 years ago

There's an already an option ($mail_settings['allow_no_mail']) to send an email or not. Are you saying that you'd also like a finer degree of control and an option to include iCalendar details? I'd be interested in understanding the circumstances where this would be useful.

Of coure it's possible to include it, but you'd need to modify functions_mail.inc.

Original comment by: campbell-m

jberanek commented 4 years ago

Actually I already turn on to send email. Im the same person that asking this ticket https://sourceforge.net/p/mrbs/support-requests/1912/. Now, some user want to include icalendar details in their email but some dont want. So, I would like to add this option (Yes/No) when doing booking for them.

Original comment by: *anonymous

jberanek commented 4 years ago

Some user want to add icalendar so that they wont forget their booking, but some dont want this booking add to their calendar, just email with details enough.

Original comment by: *anonymous

jberanek commented 4 years ago

You'd need to create a custom field, let's say it's called include_ics. Then, assuming you are running MRBS 1.7.3, you'd need to modify functions_mail.inc and modify

lines 939 and 1025 from

  if ($mail_settings['icalendar'] && !$enable_periods)

to

  if ($data['include_ics'] && $mail_settings['icalendar'] && !$enable_periods)

and line 1296 from

  if (!$mail_settings['icalendar'] || $enable_periods)

to

  if (empty($attachment))

I haven't tested this though.

Original comment by: campbell-m

jberanek commented 4 years ago

Thank you again! I'll test this tomorrow..

Original comment by: *anonymous

jberanek commented 4 years ago

Im sorry actually im using 1.8.0 now. then I try changed the following line: 948 and 976 with

  //if ($mail_settings['icalendar'] && !$enable_periods)
  if ($data['include_ics'] && $mail_settings['icalendar'] && !$enable_periods)

1249

  //if (!$mail_settings['icalendar'] || $enable_periods)
  if (empty($attachment))

I turn on debug, this is part of debug log

  [confirmed] => 1
    [f_email_add] => email@mail.com
    [f_include_ics] => on
    [rep_type] => 0
    [rep_day] => Array
        (
            [0] => 4
        )

Booking details shown Yes

But at the end, email received. But no ics.

Original comment by: *anonymous

jberanek commented 4 years ago

I'm not quite sure which lines you have changed. Can you post your functions_mail.inc here please?

Original comment by: campbell-m

jberanek commented 4 years ago

Attached.

Original comment by: *anonymous

Attachments: https://sourceforge.net/p/mrbs/support-requests/_discuss/thread/cc1f6c6120/12c3/1301/attachment/functions_mail.inc

jberanek commented 4 years ago

OK, thanks. Use the version attached. I've also modified lines 843 and 888.

Original comment by: campbell-m

Attachments: https://sourceforge.net/p/mrbs/support-requests/_discuss/thread/cc1f6c6120/cb71/attachment/functions_mail.inc

jberanek commented 4 years ago

Ok, tested and Wow! Its working lol. andd.. Thank you again for your help. Some info that maybe would help others, you need to change $mail_settings['icalendar'] = true; inside config file to make this works. BTW, can we change email subject when ics file include? because email subject will follow booker name field when there's ics details.

Original comment by: *anonymous

jberanek commented 4 years ago

Good, glad it works. Yes you can change the subject line for iCalendar notifications if you want to by changing lines 845 and 951 in your file. Or else change lines 843 and 949 to

  if (false)

However the subject line is deliberately set to be the brief description of the booking for iCalendar notifications due to the behaviour of some email clients. So if you make the change you might want to test against a variety of clients. See also https://sourceforge.net/p/mrbs/support-requests/210/ and also the comments in the code:

  // If we're sending iCalendar notifications, then it seems that some calendar
  // applications use the email subject as the booking title instead of the iCal
  // SUMMARY field.   As far as I can see this is wrong, but as a circumvention
  // we'll put the booking title in the email subject line.   (See also
  // SF Tracker id 3297799)

Original comment by: campbell-m

jberanek commented 4 years ago

Noted, will try. Most of the time we will be using outlook mail in our campus.

Original comment by: *anonymous