[#747] Massive Creation of Provider's Schedules

Migrated from Redmine #747 | Author: Sergio Campos
Status: New | Priority: High, I’m very impatient | Created: 2021-07-30


Hello to all !

I have a Premium account (Client Ingenes) and I’d like to have a way to import or create in a massive way schedules for my service providers. Let me explain myself:

We currently have a in-house developed booking system, and we have about 10 branches with 10 service providers for branch. Only one person is responsible of creating the schedules for all branches and service providers. He creates all the schedules in a excel file, and then he imports this file to the in-house booking system and all schedules are created in the system. I am attaching a sample of this file. On this file, the sheet that is imported is the one that says LayOut… The other are only references.

We configure the schedules based on roles and later we only assign the Providers to this roles through importing the layout sheet.

We want to do that in Simplybook, and we made a request for this and the developement dept. answered that:

“We can use API for coding a solution for this request”, however we do not know what method or function to use. Can you suggest a solution for this ? We have a cluster with about 12 subcounts and we need to be able to import the schedules for service provider.

Regards

Redmine Admin wrote:

You can use this method of admin API
Authorization descibed here API documentation | SimplyBook.me Online Scheduling
make sure to use Admin auth

/**
     * Set work day schedule for company|service|provider for week_day|date
     * @param array $info
     *
     * Example:
     *
     *   {
     *   "start_time":"10:00",
     *   "end_time":"18:00",
     *   "is_day_off":0,
     *   "breaktime":[{"start_time":"14:00","end_time":"15:00"}],
     *   "index":"1",
     *   "name":"Monday",
     *   "date":"",
     *   "unit_group_id":"",
     *   "event_id":""
     *   }
     *
     *
     * index is 1-7 for Monday - Sunday (used for weekly settings)
     * date is used to set worktime for special date
     * unit_group_id is provider id
     * event_id is service id
     * if unit_group_id and event_id not passed then it set data for company
     *
     * @return boolean true on success
     */
    public function setWorkDayInfo($info)

Sergio Campos wrote:

Thanks a Lot ! We started checking this function. I want to confirm as well if for deleting or modifying the WorkDay Info i should use the function: deleteSpecialDay.

Is this correct ?

Redmine Admin wrote:

Of course you can use this method but only for special date settings

Sergio Campos wrote:

I have another question:

I’ve been using the setWorkDayInfo function, and I am trying to set several times on a day, I mean this:

For special date 2021-08-17, I want to enable the following times: 07:00 to 07:10 and 08:00 to 08:10, however I can’t set 2 times, it only allows me to enable one time (the last one). I am using the following code:

$info=array(
“start_time”=>“07:00”,
“end_time”=>“07:10”,
“is_day_off”=>0,
“breaktime”=>“”,
“index”=>“0”,
“name”=>“Name”,
“date”=>“2021-08-17”,
“unit_group_id”=>“3”,
“event_id”=>“2”
);

$enable=$client->setWorkDayInfo($info);

$info=array(
“start_time”=>“08:00”,
“end_time”=>“08:10”,
“is_day_off”=>0,
“breaktime”=>“”,
“index”=>“0”,
“name”=>“Name”,
“date”=>“2021-08-17”,
“unit_group_id”=>“3”,
“event_id”=>“2”
);

$enable=$client->setWorkDayInfo($info);

Can you give some ligth on this ?

Regards

Redmine Admin wrote:

start time and end time is longest period of your working day. Non working time must be set using “breaktime”:[{“start_time”:“14:00”,“end_time”:“15:00”}] array

Sergio Campos wrote:

I change my code to:

$info=array(
“start_time”=>“07:00”,
“end_time”=>“08:00”,
“is_day_off”=>0,
“breaktime”=>Array(“start_time”=>“07:30”,“end_time”=>“07:40”),
“index”=>“0”,
“name”=>“Name”,
“date”=>“2021-08-17”,
“unit_group_id”=>“3”,
“event_id”=>“2”
);

In order to allow times from 07:00 to 08:00 with a break on 07:30 to 07:40, but I’ve got the following image:

Redmine Admin wrote:

make sure all your time settings are multiple of timeframe. E.g. it is not possible to set 07:40 if timefrane is 30 minutes. For such scenario it must be 10 minutes

Sergio Campos wrote:

Yes they are ! I have timeframes of 10 minutes. Unfortunately I can’t upload the image, but it enables the times from 00:00 hrs to 08:00 hrs…

Redmine Admin wrote:

it is impossible to set workday for service provider and service pair, you should pass only one of them not both “unit_group_id”=>“3”,
“event_id”=>“2”

Sergio Campos wrote:

You are wonderful!!! That’s it ! It works now. Thank you very much !

Regards.

Sergio Campos wrote:

Hello, I have another question, on the API V2, which is the method that I should use ?

Thanks in advance !

Redmine Admin wrote:

there is no such functionality in API v2