Booked Scheduler Community Support
October 22, 2018, 03:01:34 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Booked 2.7 beta has been released!
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Booked 2.6.7: ReservationCreatedEmailAdmin not supplying all info  (Read 648 times)
vuw-ecs-kevin
Newbie
*

Karma: 0
Posts: 3


« on: September 21, 2017, 12:49:29 AM »

Hi there,

been looking at moving our 2.5.x Booked installation over to 2.6.x,
specifically, 2.6.7.

In testing we noticed that the email that an Administrator received,
which used to contain information about the requested booking, of the
form


User: Test User
Starting: 23/07/2018 @ 08:00 (Pacific/Auckland)
Ending: 23/07/2018 @ 17:00 (Pacific/Auckland)
Resource: ROOM001
Title: Test: please ignore
Description: ROOM001, 08:00->17:00, every Monday from 2018-07-23 to 2018-10-29
The reservation occurs on the following dates:
23/07/2018
30/07/2018
06/08/2018
...
22/10/2018
29/10/2018

One or more of the resources reserved require approval before usage. Please
ensure that this reservation request is approved or rejected.

View this reservation | Log in to Booked Scheduler


no longer puts in the

  The reservation occurs on the following dates:

block.

Looking at 2.5.21's

lang/en_us/ReservationCreated.tpl:

we see


        {if count($RepeatDates) gt 0}
                <br/>
                The reservation occurs on the following dates:
                <br/>
        {/if}

        {foreach from=$RepeatDates item=date name=dates}
                {formatdate date=$date}<br/>
        {/foreach}



whereas, for 2.6.7. we see



{if count($RepeatRanges) gt 0}
        <br/>
        The reservation occurs on the following dates:
        <br/>
{/if}

{foreach from=$RepeatRanges item=date name=dates}
        {formatdate date=$date->GetBegin()}
    {if !$date->IsSameDate()} - {formatdate date=$date->GetEnd()}{/if}
        <br/>
{/foreach}



so clearly, there's been a change from RepeatDates to RepeatRanges.

If we look at the places at where the RepeatRanges array is populated,
we see, in 2.6.7's

  lib/Email/Messages/ReservationEmailMessage.php

this loop, populating the repeatRanges array


  $repeatDates = array();
  if ($this->reservationSeries->IsRecurring())
  {
          foreach ($this->reservationSeries->Instances() as $repeated)
          {
                  $repeatDates[] = $repeated->StartDate()->ToTimezone($this->timezone);
                  $repeatRanges[] = $repeated->Duration()->ToTimezone($this->timezone);
          }
  }
  $this->Set('RepeatDates', $repeatDates);
  $this->Set('RepeatRanges', $repeatRanges);
  $this->Set('RequiresApproval', $this->reservationSeries->RequiresApproval());
  $this->Set('ReservationUrl', sprintf("%s?%s=%s", Pages::RESERVATION, QueryStringKeys::REFERENCE_NUMBER, $currentInstance->ReferenceNumber()));
  $icalUrl = sprintf("export/%s?%s=%s", Pages::CALENDAR_EXPORT, QueryStringKeys::REFERENCE_NUMBER, $currentInstance->ReferenceNumber());
  $this->Set('ICalUrl', $icalUrl);


but that in

   lib/Email/Messages/ReservationCreatedEmailAdmin.php

the equivalent loop is


  $repeatDates = array();
  foreach ($this->reservationSeries->Instances() as $repeated)
  {
          $repeatDates[] = $repeated->StartDate()->ToTimezone($this->timezone);
  }
  $this->Set('RequiresApproval', $this->reservationSeries->RequiresApproval());
  $this->Set('RepeatDates', $repeatDates);
  $this->Set('ReservationUrl', Pages::RESERVATION . "?" . QueryStringKeys::REFERENCE_NUMBER . '=' . $currentInstance->ReferenceNumber());


and so the RepeatRanges array is NOT being populated.

Was that a design choice ?

AS it was not a design choice we wished to adopt, we simply patched

   lib/Email/Messages/ReservationCreatedEmailAdmin.php

so that the loop, and assignment of the booking's RepeatRanges
attribute is now


  $repeatDates = array();
  foreach ($this->reservationSeries->Instances() as $repeated)
  {
          $repeatDates[] = $repeated->StartDate()->ToTimezone($this->timezone);
          $repeatRanges[] = $repeated->Duration()->ToTimezone($this->timezone);
  }
  $this->Set('RequiresApproval', $this->reservationSeries->RequiresApproval());
  $this->Set('RepeatDates', $repeatDates);
  $this->Set('RepeatRanges', $repeatRanges);
  $this->Set('ReservationUrl', Pages::RESERVATION . "?" . QueryStringKeys::REFERENCE_NUMBER . '=' . $currentInstance->ReferenceNumber());



and such a patch sees our Admin emails now contain the same information
as they did in the 2.5.x series.

Kevin Buckley
School of Engineering and Computer Science
Victoria University of Wellington
New Zealand
Logged
vuw-ecs-kevin
Newbie
*

Karma: 0
Posts: 3


« Reply #1 on: November 09, 2017, 04:22:54 AM »

Just in case anyone who added to the "Views" count was waiting
for one of the developers to follow up on this, a very similar patch
to mine has been applied into the 2.6.8 release, so I guess this
"issue" should be considered closed.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2006-2007, Simple Machines Valid XHTML 1.0! Valid CSS!