Check on trashed items when fetching appointment information

This commit is contained in:
Alex Tselegidis 2023-03-17 07:53:16 +01:00
parent b3a82bf5f4
commit 7bfe16b6be
2 changed files with 21 additions and 21 deletions

View file

@ -267,9 +267,9 @@ class Calendar extends EA_Controller {
}
$appointment = $this->appointments_model->find($appointment['id']);
$provider = $this->providers_model->find($appointment['id_users_provider']);
$customer = $this->customers_model->find($appointment['id_users_customer']);
$service = $this->services_model->find($appointment['id_services']);
$provider = $this->providers_model->find($appointment['id_users_provider'], TRUE);
$customer = $this->customers_model->find($appointment['id_users_customer'], TRUE);
$service = $this->services_model->find($appointment['id_services'], TRUE);
$settings = [
'company_name' => setting('company_name'),
@ -320,9 +320,9 @@ class Calendar extends EA_Controller {
// Store appointment data for later use in this method.
$appointment = $this->appointments_model->find($appointment_id);
$provider = $this->providers_model->find($appointment['id_users_provider']);
$customer = $this->customers_model->find($appointment['id_users_customer']);
$service = $this->services_model->find($appointment['id_services']);
$provider = $this->providers_model->find($appointment['id_users_provider'], TRUE);
$customer = $this->customers_model->find($appointment['id_users_customer'], TRUE);
$service = $this->services_model->find($appointment['id_services'], TRUE);
$settings = [
'company_name' => setting('company_name'),
@ -518,9 +518,9 @@ class Calendar extends EA_Controller {
foreach ($response['appointments'] as &$appointment)
{
$appointment['provider'] = $this->providers_model->find($appointment['id_users_provider']);
$appointment['service'] = $this->services_model->find($appointment['id_services']);
$appointment['customer'] = $this->customers_model->find($appointment['id_users_customer']);
$appointment['provider'] = $this->providers_model->find($appointment['id_users_provider'], TRUE);
$appointment['service'] = $this->services_model->find($appointment['id_services'], TRUE);
$appointment['customer'] = $this->customers_model->find($appointment['id_users_customer'], TRUE);
}
unset($appointment);
@ -646,9 +646,9 @@ class Calendar extends EA_Controller {
foreach ($response['appointments'] as &$appointment)
{
$appointment['provider'] = $this->providers_model->find($appointment['id_users_provider']);
$appointment['service'] = $this->services_model->find($appointment['id_services']);
$appointment['customer'] = $this->customers_model->find($appointment['id_users_customer']);
$appointment['provider'] = $this->providers_model->find($appointment['id_users_provider'], TRUE);
$appointment['service'] = $this->services_model->find($appointment['id_services'], TRUE);
$appointment['customer'] = $this->customers_model->find($appointment['id_users_customer'], TRUE);
}
// Get unavailability periods (only for provider).

View file

@ -282,11 +282,11 @@ class Appointments_api_v1 extends EA_Controller {
$deleted_appointment = $occurrences[0];
$service = $this->services_model->find($deleted_appointment['id_services']);
$service = $this->services_model->find($deleted_appointment['id_services'], TRUE);
$provider = $this->providers_model->find($deleted_appointment['id_users_provider']);
$provider = $this->providers_model->find($deleted_appointment['id_users_provider'], TRUE);
$customer = $this->customers_model->find($deleted_appointment['id_users_customer']);
$customer = $this->customers_model->find($deleted_appointment['id_users_customer'], TRUE);
$settings = [
'company_name' => setting('company_name'),
@ -320,11 +320,11 @@ class Appointments_api_v1 extends EA_Controller {
{
$manage_mode = $action === 'update';
$service = $this->services_model->find($appointment['id_services']);
$service = $this->services_model->find($appointment['id_services'], TRUE);
$provider = $this->providers_model->find($appointment['id_users_provider']);
$provider = $this->providers_model->find($appointment['id_users_provider'], TRUE);
$customer = $this->customers_model->find($appointment['id_users_customer']);
$customer = $this->customers_model->find($appointment['id_users_customer'], TRUE);
$settings = [
'company_name' => setting('company_name'),
@ -376,9 +376,9 @@ class Appointments_api_v1 extends EA_Controller {
if ($aggregates)
{
$appointment['service'] = $this->services_model->find($appointment['id_services'] ?? $appointment['serviceId'] ?? NULL);
$appointment['provider'] = $this->providers_model->find($appointment['id_users_provider'] ?? $appointment['providerId'] ?? NULL);
$appointment['customer'] = $this->customers_model->find($appointment['id_users_customer'] ?? $appointment['customerId']) ?? NULL;
$appointment['service'] = $this->services_model->find($appointment['id_services'] ?? $appointment['serviceId'] ?? NULL, TRUE);
$appointment['provider'] = $this->providers_model->find($appointment['id_users_provider'] ?? $appointment['providerId'] ?? NULL, TRUE);
$appointment['customer'] = $this->customers_model->find($appointment['id_users_customer'] ?? $appointment['customerId'] ?? NULL, TRUE);
$this->services_model->api_encode($appointment['service']);
$this->providers_model->api_encode($appointment['provider']);
$this->customers_model->api_encode($appointment['customer']);