mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-26 01:43:06 +03:00
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
|
@ -128,11 +128,12 @@ class Appointments extends API_V1_Controller {
|
||||||
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