Resolve the any-provider selection before processing provider information (#885).

This commit is contained in:
Alex Tselegidis 2020-09-21 14:26:15 +03:00
parent 3079c513a8
commit ae1f951cf8

View file

@ -967,6 +967,14 @@ class Appointments extends CI_Controller {
$appointment = $post_data['appointment'];
$customer = $post_data['customer'];
// Check appointment availability before registering it to the database.
$appointment['id_users_provider'] = $this->check_datetime_availability();
if ( ! $appointment['id_users_provider'])
{
throw new Exception(lang('requested_hour_is_unavailable'));
}
$provider = $this->providers_model->get_row($appointment['id_users_provider']);
$service = $this->services_model->get_row($appointment['id_services']);
@ -985,12 +993,6 @@ class Appointments extends CI_Controller {
return;
}
// Check appointment availability before registering it to the database.
if ( ! $this->check_datetime_availability())
{
throw new Exception(lang('requested_hour_is_unavailable'));
}
if ($this->customers_model->exists($customer))
{
$customer['id'] = $this->customers_model->find_record_id($customer);