forked from mirrors/easyappointments
Code changes on automatically end_datetime assignment via the REST API
This commit is contained in:
parent
5269f73bab
commit
07276d46a6
1 changed files with 5 additions and 4 deletions
|
@ -125,14 +125,15 @@ class Appointments extends API_V1_Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate end_datetime based on service duration if this field is not defined
|
// Generate end_datetime based on service duration if this field is not defined
|
||||||
if (!isset($appointment['end_datetime']))
|
if ( ! isset($appointment['end_datetime']))
|
||||||
{
|
{
|
||||||
$service = $this->services_model->get_row($appointment['id_services']);
|
$service = $this->services_model->get_row($appointment['id_services']);
|
||||||
|
|
||||||
if (isset($service['duration']))
|
if (isset($service['duration']))
|
||||||
{
|
{
|
||||||
$endTime = new DateTime($appointment['start_datetime']);
|
$end_datetime = new DateTime($appointment['start_datetime']);
|
||||||
$endTime->add(new DateInterval('PT' . $service['duration'] . 'M'));
|
$end_datetime->add(new DateInterval('PT' . $service['duration'] . 'M'));
|
||||||
$appointment['end_datetime'] = $endTime->format('Y-m-d H:i:s');
|
$appointment['end_datetime'] = $end_datetime->format('Y-m-d H:i:s');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue