Provider breaks

1,224 views
Skip to first unread message

Ferven Italia

unread,
Jan 2, 2016, 9:12:25 AM1/2/16
to Easy!Appointments - Support Group
Hi there,

In my company there is some appointments that have a duration of 120 minutes or more. Now, the problem is that if I set a break for a particular provider and try to take the appointment with this long service I get false from: check_datetime_availability 'cause the appointment duration exceeds the period ends. Now I want to know how I can edit the code for allow my customer to take the appointments. The breaks are only a time slot for the selected hours windows in the front end, I don't want that the breaks prevent my clients to make an appointment. Which change I should do? Thanks and happy new year.

Craig Tucker

unread,
Jan 2, 2016, 10:48:42 AM1/2/16
to Easy!Appointments - Support Group
So, what I am understanding is that your 120 min. appointment is showing up for time slots that are not available due to the 30 min break.  Or somehow, the 30 min. break is not being calculated when EA is determining available hours?  Am I understanding you correctly?

Ferven Italia

unread,
Jan 2, 2016, 11:25:44 AM1/2/16
to Easy!Appointments - Support Group
Exactly, pretty much the break from work does not allow to my client to take the appointment and I want to make sure to remove this limit. This is because the time slot are to be displayed only neglio times available (that is, those who choose you as the start time of appointment). But if the appointment exceed a break from work, the code does not have to take this into account because my operator must still work regardless of whether the break is on an appointment period or not. Let's say that the pause is relative. How can do this?

Alex Tselegidis

unread,
Jan 4, 2016, 4:51:16 PM1/4/16
to Easy!Appointments - Support Group
Use the following workaround in the "get_provider_available_time_periods" of the appointments.php file. 

Step 1) Add a new parameter to the method "get_provider_available_time_periods"  with the name "$exclude_breaks" and default value to FALSE. 

Step 2) Do the same for the "check_datetime_availability" method. 

Step 3) Find the "if (isset($selected_date_working_plan['breaks'])) {" condition inside the "get_provider_available_time_periods" and convert it to "if (isset($selected_date_working_plan['breaks']) && !$exclude_breaks) {".

Step 4) Find the "check_datetime_availability" call inside the "ajax_register_appointment" method and add the TRUE argument so that you "exclude the breaks" >> $this->check_datetime_availability(TRUE); 

Step 5) Inside the "check_datetime_availability"  find the "get_provider_available_time_periods"  call and use the $exclude_breaks in the argument. 

Step 6) Append the "get_provider_available_time_periods" call with a TRUE argument inside the "ajax_get_available_hours".

This dirty fix will disable the breaks only for the register appointment AJAX callback. 

It was made in BETA v1.1 

A file is attached for simplicity


appointments.php

Ferven Italia

unread,
Jan 5, 2016, 7:23:03 AM1/5/16
to Easy!Appointments - Support Group
Hi Alex, thanks for the answer. Your fix anyway, is only a partial fix. Infact in ajax_register_appointment method:

if(!$this->check_datetime_availability(TRUE))
{
throw new Exception($this->lang->line('Hours not available'));
}

If the appointment is new, so the id isn't provided, in check_datetime_availability

$available_periods = $this->get_provider_available_time_periods(
$appointment['guid_users_provider'], date('Y-m-d', strtotime($appointment['start_datetime'])),
$exclude_appointments, $exclude_breaks);

the variable above will be returned empty, so it means that the user can't register a new appointment. This situation only happean with new appointment, infact the last for each in get_provider_avilable_time_periods, for precision, this:

foreach($reserved_appointments as $appointment) {

valorize the period only if there is already an appointment in (edit). I guess for fix this the breaks should totally removed in the previous for each, where there is the condition:

if (isset($selected_date_working_plan['breaks']) && !$exclude_breaks) {

so should be returned the complete period without breaks (start and end). I'm right? 

Tell me your idea on this, thanks.

Alex Tselegidis

unread,
Jan 5, 2016, 4:46:18 PM1/5/16
to Easy!Appointments - Support Group
Well to be honest I would completely remove the breaks if I were you. The reason is that dirty fixes will not be stable enough and there will always be some risk that something might break during the app execution leading to undesirable behavior.

But I guess since you came up this far you will be able to find something suitable soon :)

Ferven Italia

unread,
Jan 5, 2016, 6:00:44 PM1/5/16
to Easy!Appointments - Support Group
What do you think if I will return an array (if the breaks are excluded) with only the start and end period of the provider? I mean I should return a period that have the complete working day of the provider, unset the unavailable hours (already spend hours if there is). It's a good way? For me the breaks only serve for show the hour selection. Which changes I should do? Anyway, this is a bug.. 'Cause if I have a service that have 200 minutes of duration, the user can't take an appointment. This is wrong for me and should be fixed. Thanks for the Support :)

Alex Tselegidis

unread,
Jan 6, 2016, 3:06:47 PM1/6/16
to Easy!Appointments - Support Group
Actually this is not a bug because if your provider should have a break that actually means that he cannot work during that time. If breaks are not strict in your company then don't enter them on the system. 

As it seems removing the breaks from your providers' working plans is the best option for you. You do not need to do any code change for that. 

If you need to change the gap between the available hours to every one hour use the provided file (originates from v1.1 BETA)
appointments.php

Ferven Italia

unread,
Jan 6, 2016, 5:12:46 PM1/6/16
to Easy!Appointments - Support Group
I know this, but I have implemented the multi-services, this means that if my client chooses more treatments and in the midst of this appointment exists a break, you know that you can't tell to the customer (see you can't make the appointment because the operator has to go on break ), this logic doesn't make sense, but I understand that a break from work should be respected. The point is that we must not prevent the customer to prevent to make an appointment just because the operator has to take a break. I make you a more practical example, an operator is working and suddenly tells the customer: (resume between half an hour that I have to go on break), not something plausible. Work breaks should be only a way to organize the hours available on the frontend (especially when the user chooses a start time for the appointment) but nothing more. However this is my point of view .. 
A question, I saw that you have attached a file, but I don't understand what changes were made, can you clarify?
PS: I saw that you entered as the future implementation of the multi-services, I have built a lot 'of features in EA appointment, actually EA appointment now there is only the basic models, so it's difficult for me, now integrate the new updates, especially for the change regarding the mod_rewrite installation ajax, let me know where I can find the file you edited to make all this, because the commit doesn't see it. But, returning to the multi-services, in the future you will have problems with the breaks if the user limits what I'm saying ..

Thanks.

Alex Tselegidis

unread,
Jan 7, 2016, 6:28:01 PM1/7/16
to Easy!Appointments - Support Group
Yeah I can see your point and what you mean by non-blocking breaks but in the current system breaks serve exactly as appointment blockers for a specific time period.

But, it could be possible to make a setting for that so that breaks do not block appointments, but then again there is no reason to enter breaks (at least this is only how I see it).

Anyway the modification I did on the file was on the appointments.php controller and will change the appointment hour gap from 15 minutes to 1 hour (eg 10:00, 11:00, 12:00...)

Ferven Italia

unread,
Jan 8, 2016, 6:05:38 AM1/8/16
to Easy!Appointments - Support Group
And your change should resolve my problem? Which function exactly you've changed? 'Cause I replace the function "calculate_available_hours", and isn't returned any hours available.

Alex Tselegidis

unread,
Jan 8, 2016, 3:19:47 PM1/8/16
to Easy!Appointments - Support Group
Well not directly but indirectly. But using this script you can remove the breaks entirely and setup the appointment gap to whatever you like (actually I'm doing this for 60 mins but it's easy to hack to whatever you like).

Solving your issue directly requires more work because E!A was not designed to work this way (e.g. take a look at how the appointment availability is validated). You cannot just disable the appointments without completely rewriting some part of the appointments controller.

Ferven Italia

unread,
Jan 9, 2016, 6:39:26 AM1/9/16
to Easy!Appointments - Support Group
Uhm :\ hope that in 1.2 you integrate this features.. When the 1.2 will be released?

Alex Tselegidis

unread,
Jan 9, 2016, 6:43:17 AM1/9/16
to Easy!Appointments - Support Group
A first release is due to April 2016. I hope I will have the time to do this until then.

Ferven Italia

unread,
Jan 9, 2016, 12:54:11 PM1/9/16
to Easy!Appointments - Support Group
Ok, no problem. Hope that you'll add this. Anyway, I saw that you've fixed the problem with ajax install, which steps I should execute for apply this fix?

Alex Tselegidis

unread,
Jan 9, 2016, 4:03:55 PM1/9/16
to Easy!Appointments - Support Group
The usual problem had to do with mod_rewrite which was not properly configured in some servers so AJAX requests were not performed correctly. Since the new version I have disabled mod_rewrite and every URL will contain the index.php so that there won't be any problems. This change was made overall the app. 

Example: 



Reply all
Reply to author
Forward
0 new messages