first commit
Some checks failed
CI / build-test (push) Has been cancelled

This commit is contained in:
2025-05-31 18:56:37 +02:00
commit 8c4798a5fd
1240 changed files with 190468 additions and 0 deletions

View File

@ -0,0 +1,50 @@
# CalDAV Calendar Sync
This page will guide you through the local configuration of Baikal, an Open Source DAV server that can be used to test
the CalDAV integration of Easy!Appointments.
> Note: This guide refers to the available Docker development configuration using docker-compose.yml
## Initial Setup
By default, Baikal is configured to run on localhost:8100, so it can be accessed by opening the browser to this address.
The first time the app is executed, it will display a small initial-configuration form that has to be submitted for
Baikal to work.
### First Configuration Page
- The right time zone value needs to be selected for synchronization to match the information Easy!Appointments sends.
- The "WebDAV authentication type" needs to be set to "Basic"
- The default username is "admin", so the password for this development account could also be "admin" or something
similar (easy to remember)
### Second Configuration Page
- The default values can be submitted unless MySQL use is preferred (although totally optional).
### Test User
After the configuration is completed and Baikal works go to the "Users and resources" page and create a test user that
will be used to sync with.
## Enabling Sync
After making sure that the local Baikal server works, Easy!Appointments will be able to connect to it and sync the
appointment data.
Baikal supports multiple user accounts, but for simplicity this guide will refer to the default account created during
the initial setup.
### Credentials
While trying to enable the CalDAV sync from the Easy!Appointments calendar page, use the following credentials after
clicking on "Enable Sync" > "CalDAV".
- URL: http://baikal/dav.php/calendars/<username-from-previous-step>/default/
- Username: <username-from-previous-step>
- Password: <password-from-previous-step>
*This document applies to Easy!Appointments v1.5.1.*
[Back](readme.md)

94
docs/console.md Normal file
View File

@ -0,0 +1,94 @@
# Console
> This page contains information about the CLI support of Easy!Appointments.
### Introduction
Starting from v1.4.0 Easy!Appointments has introduced CLI support, providing a set of useful utilities to use with your installation.
The commands can be executed with PHP installed on your server and available from within the terminal. To ensure that you have PHP configured properly run the following command from within a terminal session.
```
php -v
```
It shall give you information about the currently installed PHP version.
The available commands are described below.
### Commands
The entry point for the CLI commands is the root `index.php` file which means that you will be calling this file with additional arguments, depending on which command you want to run.
##### Migrate
```
php index.php console migrate
```
This command will migrate the database to the latest state.
```
php index.php console migrate fresh
```
This command will reset any change made by the previous migrations and start from the beginning.
##### Seed
```
php index.php console seed
```
This command will add a test admin, provider, customer and service in the app, so that you can already run some tests.
##### Install
```
php index.php console install
```
This command will perform a CLI installation of Easy!Appointments.
You can run this after your are done configuring your app from the root `config.php` file.
##### Backup
```
php index.php console backup
```
This command will create a backup of the application data in the `storage/backups` directory.
```
php index.php console backup /path/to/backup/folter
```
You can also provide a custom directory for your backup files.
##### Sync
```
php index.php console sync
```
This command will trigger the calendar synchronization for all the system providers.
It is especially important, because it can be automatically executed on a regular base with a cron job.
This way the app provider schedules will always be updated.
##### Help
```
php index.php console help
```
This command will give more information about the console capabilities.
*This document applies to Easy!Appointments v1.5.1.*
[Back](readme.md)

56
docs/docker.md Normal file
View File

@ -0,0 +1,56 @@
# Docker
Run the development containers of Easy!Appointments with Docker and Docker Compose utility. Docker allows you to compose your application in microservices, so that you can easily get started with the local development.
Simply clone the project and run `docker compose up` to start the environment.
You will need modify the root `config.php` so that it matches the following example:
```php
class Config {
// ------------------------------------------------------------------------
// GENERAL SETTINGS
// ------------------------------------------------------------------------
const BASE_URL = 'http://localhost';
const LANGUAGE = 'english';
const DEBUG_MODE = TRUE;
// ------------------------------------------------------------------------
// DATABASE SETTINGS
// ------------------------------------------------------------------------
const DB_HOST = 'mysql';
const DB_NAME = 'easyappointments';
const DB_USERNAME = 'user';
const DB_PASSWORD = 'password';
// ------------------------------------------------------------------------
// GOOGLE CALENDAR SYNC
// ------------------------------------------------------------------------
const GOOGLE_SYNC_FEATURE = FALSE; // You can optionally enable the Google Sync feature.
const GOOGLE_CLIENT_ID = '';
const GOOGLE_CLIENT_SECRET = '';
}
```
In the host machine the server is accessible from `http://localhost` and the database from `localhost:3306`.
You can additionally access phpMyAdmin from `http://localhost:8080` (credentials are `root` / `secret`) and Mailpit from `http://localhost:8025`.
Baikal, a self-hosted CalDAV server used to develop the CalDAV syncing integration is available on `http://localhost:8100` (credentials are `admin` / `admin`).
While activating CalDAV sync with the local Docker-based Baikal, you will need to first create a new Baikal user and then the credentials you defined along with the http://baikal/dav.php URL
Openldap is configured to run through `openldap` container and ports `389` and `636`.
Phpldapadmin, an admin portal for openldap is available on `http://localhost:8200` (credentials are `cn=admin,dc=example,dc=org` / `admin`).
**Attention:** This configuration is meant to make development easier. It is not intended to server as a production environment!
A production image of Easy!Appointments can be found at: https://github.com/alextselegidis/easyappointments-docker
*This document applies to Easy!Appointments v1.5.1.*
[Back](readme.md)

59
docs/faq.md Normal file
View File

@ -0,0 +1,59 @@
# FAQ
## How do I check that my server has Apache, Php and MySQL already installed?
Easy!Appointments is a php application and needs an apache server with php and mysql installed. Apart from that, the php "curl" extension and the apache module "mod_rewrite" need to be enabled. To check if your server fullfils the needed prerequisites you will need to either contact the web hosting company or create a php file on your web root directory with the content <?php phpinfo(); ?> and then access it from the web (eg "phpinfo.php" >> "http://domain-name.com/phpinfo.php"). This url will display all the server details.
## How do I create a Google Calendar API key?
Google needs to authorize the usage of her services, so you need to create an API key for your Easy!Appointments installation. In order to do that you will need a google account. When logged in, go to the Google Developers Console and create a new project. Enable the Calendar API service and then head to the "APIs & Auth >> Credentials" menu item. There, you will need to create a new OAuth client id. The last step is to enter a valid redirect url for the authrorization process. This is very important because if the redirect url is wrong, you will not be able to use the google synchronization feature on your E!A installation. For your redirect url enter the following value: "http://domain-name/folder-to-ea-installation/google/oauth_callback" (replace the domain name and the path to the Easy!Appointments installation folder with your server values). For example if E!A is installed on the "ea" folder on the web root directory the valid redirect url would be "http://my-domain/ea/google/callback".
## Installation Page Is Not Working
Various users have reported on the support group that they cannot complete the installation successfully. This is primarily because of two reasons (a) either the configuration.php file was set incorrectly, or the server settings won't allow AJAX calls to be completed successfully and thus let the installation finish. For the first situation you will have to check that you have properly set the $base_url parameter to "https://url/to/easyappointments/folder/" (last slash is necessary!), for example "http://easyappointments.org/ea-installation/". Then ensure that your database connection credentials is correct. In the second situation the things are more complex. Users have stated that in some web hosts you need to change the .htaccess file in order for the application to work (htacces snippet provided below). If this doesn't work then check the apache error log and open the browser javascript console after you press the "Install E!A" button. There you will find information about what is going wrong with your installation. Contact your hosting company and ask them to resolve these issues.
.htaccess
```
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
```
##Booking Wizard Won't Display Any Hours
This issue comes when the customer is on the appointment book wizard but he is not seeing any available appointment hours and he cannot continue either. If your installation has this problem check the apache error log and open the browser's javascript console to find any issues. This is definetely a server issue and can only fixed by contacting your hosting company. It has to do with your server settings not letting Easy!Appointments run correctly. Normally you or the web hosting company will be able to find what needs to be changed in order to solve the issue.
Booking Wizard Displays "There are no available appointment hours for the selected date. Please choose another date."
... Even though there are available time periods in my plan.
This is not actually an issue but it happened to a user and it was indeed confusing to resolve. A clean installation of E!A has some default settings such as the default working plan that contains some breaks too during the working days. This was set this way in order for you to see how can a working plan be like and set. So if you add a service that lasts for several hours (eg. 3~4 hours) then because of the default breaks new appointments will not fit in any empty time period of your calendar and thus the customer will not be able to book appointments with you. So if your services last for long you will need to change the working plan of your providers too so new appointments will fit into their schedule.
##Installing E!A on Subdomain Won't Load Appointment Hours
If you want to install Easy!Appointments on a subdomain you will have to use the subdomain URL in your "configuration.php" file and not the initial URL directory. For example if you have the subdomain "http://book.mysite.com" where E!A resides and this subdomain is mapping on "http://mysite.com/book", you will have to set $base_url = 'http://book.mysite.com' in your "configuration.php" file, otherwise you will get a No 'Access-Control-Allow-Origin' error and you won't get any available appointment hours on frontend.
##Change the gap of the available hours of the booking wizard to 60 minutes (or similar).
The following link points to a common question that many users ask. The default gap between the available appointment hours is 15 minutes. In the following thread there is a file attached which will change this gap to 60 minutes.
(https://groups.google.com/d/msg/easy-appointments/Mdt98fbF8hE/9CEjOvW7FAAJ)
## DateTime::__construct(): It is not safe to rely on the system's timezone settings...
You get this warning because PHP is not configured with a timezone setting. This is a very important setting especially for Easy!Appointments, cause otherwise you might get into trouble with the appointment hours. After
installing the application, make sure that the php.ini "date.timezone" setting has the correct value depending
your location. You can find a list of the [available timezone setting on php.net](http://www.google.com/url?q=http%3A%2F%2Fphp.net%2Fmanual%2Fen%2Ftimezones.php&sa=D&sntz=1&usg=AFQjCNFtFw3O6UQXAKFKWCXqhSd9Z0UwgQ). If you cannot modify your php.ini file try to add the following command at the top of `index.php`.
`date_default_timezone_set('America/Los_Angeles'); // Use your own timezone string.`
*This document applies to Easy!Appointments v1.5.1.*
[Back](readme.md)

25
docs/get-involved.md Normal file
View File

@ -0,0 +1,25 @@
# Get Involved
> Learn in which ways you can get involved with the project development!
Easy!Appointments is an open source project and thus the connection with the users community is stronger than commercial projects. People can contribute in the development and spread of this project and make it even better so that they, themselves can take advantage of it in order to fulfill their business needs. Bellow are described the ways that you can help Easy!Appointments get better.
### Testing
The most important goal of Easy!Appointments is performance and stability and that means that **everything must work as expected**. Even though the project has been tested thoroughly during its Beta phase it is important that bugs are tracked down and are fixed as soon as possible.
### Suggestions
Everything you might suggest about the project will be taken into concern and is highly appreciated. Your ideas of new features and enhancements are very important and will help Easy!Appointments become even better. So do not hesitate to submit your suggestions and feature requests to [E!A Submission Form](http://easyappointments.org/submission.php)
### Translation
You are more than welcome to help with the translation progress of the user interface. The application is already translated into a big variety of languages but as new features are added new strings need to be translated. You can send your translations with a pull request in GitHub or per email to [alextselegidis@gmail.com](mailto:alextselegidis@gmail.com)
### User Feedback
It would be much appreciated if you would take 5 minutes of your time to fill this small form on your experience with Easy!Appointments. User feedback is very important and will help with the future planning of the project. Fill the [E!A Feedback Form](https://docs.google.com/forms/d/15dw1jl7lUgw4q-XXMn13Gx_e8zJxAiyWYMOdqtZqIHU/viewform).
*This document applies to Easy!Appointments v1.5.1.*
[Back](readme.md)

View File

@ -0,0 +1,52 @@
# Google Calendar Sync
> This page will guide you through the activation of the Google Calendar synchronization feature.
Since version 1.0 Easy!Appointments supports two way synchronization with the Google Calendar API. Every provider can link his Google Calendar account with the application and make sure that any modification made on the schedule is synced between both systems. Easy!Appointments will add extra information (if available) to Google Calendar events so that users can check event participants, reply whether they will come or not etc. Once the events are on Google Calendar they can then be synced and used by other services that support Googles API.
So, these are the required steps for enabling the Google Calendar Sync feature of Easy!Appointments.
## Working Easy!Appointments Installation
The installation must be fully functional and configured and needs to have some services and providers.
## Google OAuth2 Credentials
The synchronization feature requires valid Google API credentials in order to reach data from Google accounts. Some services have a maximum quota for their free use (fortunately the Calendar API provides 1.000.000 requests/day).
- Go to the Google Cloud Console and create a new project.
- Click on **Use Google APIs** box and enable the Google Calendar API.
- Then click on the **Credentials** menu item (on the left) and create an **OAuth client ID** for your installation. You will need to fill the consent screen information and then select **Web Application** in the next frame. Give it a client name and add your installation domain as the **Authorised JavaScript origins** (important give only the domain not the complete URL e.g. `http://mywebsite.com`). The **Authorised redirect URIs** field will need the following value `https://url/to/easyappointments/folder/index.php/google/oauth_callback` (replace `url/to/easyappointments/installation` with your real domain).
- Click on **Create** button to complete the wizard. Afterwards Google Cloud will show you two key strings that you need to mark for the following step.
## Google API Key
Customers will be able to sync their appointments with their Google Calendars but beforehand you will need an API key. Click again on the **Create credentials** button while being in the Credentials overview page and select **API Key**. A modal dialog will be shown asking you the type of key to create. Select the **Browser Key** option and fill the following form with your installation data.
## Easy!Appointments Syncing Feature
To enable the synchronization edit your root config.php file and update the Google Calendar Sync section with your API credentials.
- `GOOGLE_SYNC_FEATURE` needs to be set to `TRUE`.
- `GOOGLE_CLIENT_ID` needs the client ID from the OAuth2 credentials.
- `GOOGLE_CLIENT_SECRET` needs the client secret from the OAuth2 credentials.
4. **Link Google Calendar and Easy!Appointments**: Go to backend/calendar page, select a provider and click on the "Enable Sync" button. A new window will pop up asking you to grant concern. Enter the user's credentials and the sync will be activated!
#### Note that ...
* Currently synchronization can only be triggered from the Easy!Appointments backend or whenever there are changes in the appointment plan.
* Every provider user can be synced with only one Google Calendar account.
* Recursive events are not supported yet.
#### Useful Links ...
Google Developers https://developers.google.com/google-apps/calendar
E!A Support Group https://groups.google.com/forum/#!forum/easy-appointments
*This document applies to Easy!Appointments v1.5.1.*
[Back](readme.md)

BIN
docs/images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -0,0 +1,34 @@
# Installation Guide
> This page will guide you through the installation and configuration of Easy!Appointments.
### Introduction
Easy!Appointments is a web appointment scheduler that can be installed and run in web servers. Users will be able to reach the application through their web browsers by using an active internet connection, just like visiting a normal website. The installation process is very similar to other popular web systems like WordPress and Joomla, so it is very likely that you will be familiar with the next steps. Follow this article strictly in order to complete the installation with no problems. After that, read the "Configuration" section for adjusting the system to fit your needs.
### Installation
There are 6 steps you must follow during the installation process.
1. **Make sure that your server has at least the following applications/tools installed: Apache(v2.4), PHP(v7.2+) and MySQL(v5.7).** Easy!Appointments needs these programs to run. Most of the web hosting companies provide these tools within their Linux hosting plans. If you want to install Easy!Appointments on your local server use one of the pre-made bundles available on the web (XAMPP, MAMP, WAMP ...), all of which are free to use. If you plan to use the Google Calendar synchronization you will need the **php_curl** extension installed and enabled as well.
2. **Create a new database (or use an existing one).** The database is necessary for storing the system data. Therefore your hosting plan must include at least one MySQL database. You must also get the database administration credentials because they will be needed later on.
3. **Upload the Easy!Appointments source files to your server.** You can place the files into a directory with named "easyappointments" or "appointments" or "book" etc. Make sure that you mark the Easy!Appointments folder URL because it will be needed in the following step. For example if the system files are placed in the this directory ".../httpdocs/easyappointments/" then the URL to this folder will be "http://your-domain.com/easyappointments". This URL will be needed in the following steps.
4. **Ensure that the "storage" directory is writable.** Session information, logs and any other kind of files will land into the "storage" directory so make sure that it has the correct permissions and that is writable.
5. **Edit the "config.php" file and set your server properties.** Like other web systems Easy!Appointments needs to know how to connect to the database and the base URL of the installation. You can also provide the Google Calendar API keys in this file, if you want to use the Google Calendar Sync feature. NOTE that you will need to create an API key before that in the Google Cloud Console.
6. **Open a web browser and head to the Easy!Appointments installation folder URL.** The first time you open this page an installation guide will be shown. Fill in the administrator user and company settings and press the "Install" button. That's it! You can now use the application at your own will.
### Configuration
When you finish the installation, Easy!Appointments will only contain an administrator user, a test service, a test provider and some default settings. You will need configure the system with your own business logic, but before that you can try adding a test appointment before proceeding with the following steps.
1. Head to backend section by entering the Easy!Appointments URL `http://installation-url/index.php/backend` in your browser. When logged in, click on the "Settings" menu item on top of the page. Click on the "Business Logic" tab and apply the working plan of your company. Press the "Save" button when you are finished. This will be the default working plan for all new providers (not the existing ones).
2. Next you will need to add the services that your customers will book appointments for. You can optionally organize these services by using custom categories. Add some records and make sure you fill the required fields.
3. Once you are ready with the services you will need to add the service providers of your company. By doing so, customers will be able to select the employee they want to provide their preferred service, during the booking procedure. Hit the "Users" menu item and then the "Providers" tab. Add a new provider user and set his working plan and services. If you wish to assign the appointments without using Easy!Appointments just create a single general provider user named with your company name. It is not necessary for the provider to know the login credentials, but if he does, he will be able to view his appointment plan and sync it with his Google Calendar account.
4. If you have a secretary handling all the appointments for your company, hit the "Secretaries" tab and add a new user. Select the providers that she can manage and save the record. The secretary user will be able to manage the appointments only for the providers she is responsible.
5. That's it! Click on the "Go To Booking Page" link on the footer of the page and create a new appointment. The new appointment will be now be visible at the "Calendar" page of the backend section. The customer's data have also been saved and can be found in the "Customers" page.
Finally just add a link in your website that points to your Easy!Appointments installation with a caption similar to "Book Appointment". Whenever a customer clicks on that link he will be redirected the booking page.
Happy Bookin'!
*This document applies to Easy!Appointments v1.5.1.*
[Back](readme.md)

99
docs/ldap.md Normal file
View File

@ -0,0 +1,99 @@
# CalDAV Calendar Sync
This page will guide you through the local configuration of OpenLDAP and phpLDAPadmin, an Open Source LDAP server that
can be used to test the LDAP integration of Easy!Appointments.
> Note: This guide refers to the available Docker development configuration using docker-compose.yml
## Initial Setup
By default, OpenLDAP is configured to run on localhost:389, so it can be accessed on the host machine from this address.
In the internal Docker Compose network the equivalent address would be openldap:389.
Similarly, phpLDAPadmin is accessible in the host environment via localhost:8200, so it can be accessed on the host
machine from this address.
OpenLDAP and phpLDAPadmin do not require any configuration or initialization for them to be used.
### Test Admin User
Once the local Docker environment is running, you can log in to phpLDAPadmin with the default admin user, by using the
following credentials:
- URL: http://localhost:8200
- User DN: cn=admin,dc=example,dc=org
- Password: admin
After logging in, you will be able to manage the LDAP directory, add new LDAP entries and search the existing data.
## Enabling Integration in Easy!Appointments
After making sure that the local OpenLDAP server works, Easy!Appointments will be able to connect to it.
For this you will need to go to the Backend > Settings > Integrations > LDAP and enable the integration from there.
This settings page also requires some configuration for Easy!Appointments to be able to connect to the server and pull
the right information.
#### Host
The server host address, provide "openldap" for Docker or your own host or IP.
#### Port
The server port number, provider 389 for Docker or your own server port value.
#### User DN
Enter the admin user domain (DN) value which is "cn=admin,dc=example,dc=org" for Docker or set your own server value.
#### Password
Enter the admin user password value which is "admin" for Docker or set your own server value.
#### Base DN
Enter the base domain (DN) value, provide "dc=example,dc=org" for Docker or a custom value as defined on your server.
#### Filter
This field has a default value which will work in most cases and will allow you to filter the right records out of the
LDAP directory. Change this if you need to filter the directory in a different way. The filter will interpolate the
{{KEYWORD}} string with the actual keyword value for filtering the LDAP entries.
#### Field Mapping
In order to save some time while importing user records, you can define the field mapping so that the required values
are prefilled within the LDAP import modal. This is a key-value json object.
## Importing Users
After the configuration of LDAP is complete, you can use the "search" function of the same settings page to look for
users (just submitting queries using the form).
If the filter was right, you will be getting LDAP entries displayed on screen that can be imported into Easy!Appointments.
Clicking the "Import" button a modal with a user form will be opened, allowing you to import this entry and change their
information before doing that.
Backend users (admin/secretary/provider) require a local password before being imported. If you do not plan to use the
local log in credentials then set a long random value instead.
Make sure that the "LDAP DN" value is correct and points to the right entry on LDAP. Also the username will be used to
detect the user, so you might want to set the same username (most of times "cn") with LDAP so that both password and
username are the same as in LDAP.
## LDAP SSO
While SSO with LDAP on Easy!Appointments, the username will need to be matched for the SSO to work. Also, the LDAP DN
value must be valid and pointing to the right record.
The LDAP DN is a value that can also be manually set, either from the UI or from the API.
If LDAP is enabled, Easy!Appointments will first try to check for the local credentials, but if this does not work, then
the app will try to check the password against the LDAP entry and log the user in.
*This document applies to Easy!Appointments v1.5.1.*
[Back](readme.md)

View File

@ -0,0 +1,19 @@
# Manage Translations
> This page will guide you through the management of Easy!Appointments translations.
### Introduction
Easy!Appointments supports the addition of custom translations in order to display the user interface into many languages and therefore be more user friendly. This page will guide you through the addition of a new translation and the configuration of the application. You can also modify the available translations or even set the default one for the application.
### Details
Easy!Appointments is based upon CodeIgniter (PHP Framework) and it uses its build-in libraries in order to translate the content into many languages. Version 1.1 of the application comes with English, German, Greek, Hungarian, Portuguese, Spanish, Italian, Japanese, Dutch, French, Simplified Chinese, Polish, Danish, Luxembourgish, Slovak, Finnish, Russian, Romanian, Turkish, Hindi and Bulgarian already included, but there is also the ability to add you own translation and change the user interface strings and captions. To add a new translation you must do the following:
1. **CREATE A TRANSLATION FOLDER INSIDE "/APPLICATION/LANGUAGE/" DIRECTORY.** If you want for example to translate the application into French then you will need to create a new folder named "french" inside the `/application/language/` directory and copy the contents of the "english" folder. You must also copy the "migration_lang.php" file from another translation directory (e.g. "german") because CodeIgniter requires it when the version migration algorithm is executed.
2. **TRANSLATE EACH STRING WITHIN YOUR "TRANSLATION_LANG.PHP" FILE INTO YOUR LANGUAGE.** You will just have to replace the English strings with your translation. Example >> `$lang['page_title'] = 'Write your translation here!';`
3. **TELL EASY!APPOINTMENTS THAT YOU HAVE ADDED A NEW TRANSLATION.** When you are finished with the translation you will need to make some changes into the core config file of Easy!Appointments located at "/application/config/config.php" in order to tell the application that there is a new translation available. Find line 90 and add your language to the array. Example >> `$config['available_languages'] = array('english', 'german', 'greek', 'hungarian', 'portuguese', 'french');`. Then change the default language, though this is optional (e.g.` $config['language'] = 'english';`).
Follow these steps in order to add or adjust your translations and modify the message of the user interface of Easy!Appointments. If you want contribute to the translation process of Easy!Appointments please read the [Get Involved](https://github.com/alextselegidis/easyappointments/wiki/Get-Involved!) wiki page for more information. Please share your translations with the user community.
*This document applies to Easy!Appointments v1.5.1.*
[Back](readme.md)

15
docs/readme.md Normal file
View File

@ -0,0 +1,15 @@
# Easy!Appointments
Welcome to the documentation pages of Easy!Appointments. Navigate through the available sections and learn how to get the most out of your installation.
- [Installation](installation-guide.md)
- [Update](update-guide.md)
- [Translations](manage-translations.md)
- [REST API](rest-api.md)
- [Console](console.md)
- [Docker](docker.md)
- [Google Calendar Sync](google-calendar-sync.md)
- [CalDAV Calendar Sync](caldav-calendar-sync.md)
- [FAQ](faq.md)
*This document applies to Easy!Appointments v1.5.1.*

503
docs/rest-api.md Normal file
View File

@ -0,0 +1,503 @@
# REST API
## Introduction
Easy!Appointments offers a flexible REST API that will enables you to handle all the information of your installations through HTTP requests. The API is using JSON as its data transaction format and features many best practices in order to make the resources easily consumable.
### Open API Specification (Swagger File)
The project has a ready-made [OpenApi file](https://raw.githubusercontent.com/alextselegidis/easyappointments/master/openapi.yml) you can download and use in order to create your client.
This file can also be imported into Postman, so that you can quickly get started making requests towards your installation.
You will find more information about Open API and Swagger on [swagger.io](https://swagger.io).
## Making Requests
The API (v1) supports [Basic Authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) which means that you will have to send the "Authorization" header with every request you make. **Always use SSL/TLS when making requests to a production installation.** That way you can ensure that no passwords will be stolen during the requests. The API expects the username and password of an administrator user.
Additionally you can configure your own API key in the settings page and pass it through as a Bearer Token with any of your requests.
The API follows the REST structure which means that the client can use various HTTP verbs in order to perform various operations to the resources. For example you should use a GET request for fetching resources, a POST for creating new and PUT for updating existing ones in the database. Finally a DELETE request will remove a resource from the system.
GET requests accept some parameter helpers that enable the sort, search, pagination and minification of the responses information. Take a look in the following examples:
### Search
Provide the `q` parameter to perform a search in the resource.
```
http://ea-installation/index.php/api/v1/appointments?q=keyword
```
### Sort
Sort the results in ascending (+) or descending (-) direction by providing the the respective sign and the property name to be used for sorting.
```
http://ea-installation/index.php/api/v1/appointments?sort=-id,+book,-hash
```
You can provide up to three sorting fields which will be applied in the provided order.
### Paginate
Paginate the result by providing the `page` parameter along with the optional `length` parameter that defaults to 20.
```
http://ea-installation/index.php/api/v1/appointments?page=1&length=10
```
### Minimize
If you need to get only specific values from each JSON resource provide the `fields` GET parameter with a list of the required property names.
```
http://ea-installation/index.php/api/v1/appointments?fields=id,book,hash,notes
```
### Aggregate (Deprecated)
Aggregate related data into result payload by providing the `aggregates` parameter.
> Notice: this parameter only applies to appointments and will be removed in the future (use the `with` paramter instead).
```
http://ea-installation/index.php/api/v1/appointments?aggregates
```
*This parameter is currently only available for appointment resources.*
### With
Attach resources to the response payload with this parameter.
```
http://ea-installation/index.php/api/v1/appointments?with=customer,service,provider
```
*This parameter is only available for resources that are related to other resources.*
### Expected Responses
Most of the times the API will return the complete requested data in a JSON string but there are some cases that the responses will contain a simple message like the following:
```
{
"code": 404,
"message": "The requested record was not found!"
}
```
Such simple messages contain the HTTP code and a message stating a problem or a success to an operation.
### Try it out!
At this point you can start experimenting with the API and your installation. The following section of this document describes the available resources and how they can be used. Before building your API consumer you can use [cURL](https://en.wikipedia.org/wiki/CURL) or [Postman](https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop) to try out the API.
Get all the registered appointments:
```
curl http://ea-installation/index.php/api/v1/appointments --user username:password
```
Get the data of a customer with ID 34:
```
curl http://ea-installation/index.php/api/v1/customers/34 --user username:password
```
Update the name of a service category with ID 23:
```
curl -H 'Content-Type: application/json' -X PUT -d '{"name": "New Name!"}' http://ea-installation/index.php/api/v1/service_categories/23 --user username:password
```
Delete the service with ID 15:
```
curl -X DELETE http://ea-installation/index.php/api/v1/services/15 --user username:password
```
You can also try the GET requests with your browser by navigating to the respective URLs.
## Resources & URIs
### Availabilities
**Resource JSON**
```
[
"09:30",
"13:00",
"13:15",
"14:00"
]
```
- `GET /api/v1/availabilities?providerId=:id&serviceId=:id[&date=:date]` Get the available appointment hours for a specific provider, service and date. The date must be in the following format `Y-m-d` e.g. `2016-07-19`.
### Appointments
**Resource JSON**
```
{
"id": 1,
"book": "2016-07-08 12:57:00",
"start": "2016-07-08 18:00:00",
"end": "2016-07-08 18:30:00",
"hash": "apTWVbSvBJXR",
"location": "Test Street 1A, 12345 Some State, Some Place"
"notes": "This is a test appointment.",
"serviceId": 1,
"providerId": 2,
"customerId": 3,
"googleCalendarId": null
}
```
- `GET /api/v1/appointments[/:id]` Get all the appointments or a specific one by providing the ID in the URI.
- `POST /api/v1/appointments` Provide the new appointment JSON in the request body to insert a new record.
- `PUT /api/v1/appointments/:id` Provide the updated appointment JSON in the request body to update an existing record. The ID in the URI is required.
- `DELETE /api/v1/appointments/:id` Remove an existing appointment record.
### Unavailabilities
**Resource JSON**
```
{
"id": 1,
"book": "2016-07-08 12:57:00",
"start": "2016-07-08 18:00:00",
"end": "2016-07-08 18:30:00",
"hash": "apTWVbSvBJXR",
"location": "Test Street 1A, 12345 Some State, Some Place",
"notes": "This is a test unavailability.",
"providerId": 1,
"googleCalendarId": null
}
```
- `GET /api/v1/unavailabilities[/:id]` Get all the unavailabilities or a specific one by providing the ID in the URI.
- `POST /api/v1/unavailabilities` Provide the new unavailability JSON in the request body to insert a new record.
- `PUT /api/v1/unavailabilities/:id` Provide the updated unavailability JSON in the request body to update an existing record. The ID in the URI is required.
- `DELETE /api/v1/unavailabilities/:id` Remove an existing unavailability record.
### Customers
**Resource JSON**
```
{
"id": 1,
"firstName": "John",
"lastName": "Doe",
"email": "john@example.org",
"phone": "+10000000000",
"address": "Test Street 1A",
"city": "Some Place",
"zip": "12345",
"timezone": "UTC",
"language": "english",
"notes": "This is a test customer."
}
```
- `GET /api/v1/customers[/:id]` Get all the customers or a specific one by providing the ID in the URI.
- `POST /api/v1/customers` Provide the new customer JSON in the request body to insert a new record.
- `PUT /api/v1/customers/:id` Provide the updated customer JSON in the request body to update an existing record. The ID in the URI is required.
- `DELETE /api/v1/customers/:id` Remove an existing customer record.
### Services
**Resource JSON**
```
{
"id": 1,
"name": "Test Service",
"duration": 15,
"price": 0.00,
"currency": "EUR",
"description": "This is a test service.",
"availabilitiesType": "flexible",
"attendantsNumber": 1,
"serviceCategoryId": null
}
```
- `GET /api/v1/services[/:id]` Get all the services or a specific one by providing the ID in the URI.
- `POST /api/v1/services` Provide the new service JSON in the request body to insert a new record.
- `PUT /api/v1/services/:id` Provide the updated service JSON in the request body to update an existing record. The ID in the URI is required.
- `DELETE /api/v1/services/:id` Remove an existing service record.
* The `availabilitiesType` must be either `flexible` or `fixed`.
### Service Categories
**Resource JSON**
```
{
"id": 1,
"name": "Test Category",
"description": "This is a test category."
}
```
- `GET /api/v1/service_categories[/:id]` Get all the service categories or a specific one by providing the ID in the URI.
- `POST /api/v1/service_categories` Provide the new service category JSON in the request body to insert a new record.
- `PUT /api/v1/service_categories/:id` Provide the updated service category JSON in the request body to update an existing record. The ID in the URI is required.
- `DELETE /api/v1/service_categories/:id` Remove an existing service category record.
### Admins
**Resource JSON**
```
{
"id": 1,
"firstName": "Jason",
"lastName": "Doe",
"email": "jason@example.org",
"mobile": "+10000000000",
"phone": "+10000000000",
"address": "Test Street 1A",
"city": "Some Place",
"state": "Some State",
"zip": "12345",
"timezone": "UTC",
"language": "english",
"notes": "This is a test admin.",
"settings":{
"username": "chrisdoe",
"password": "Password@123",
"notifications": true,
"calendarView": "default"
}
}
```
- `GET /api/v1/admins[/:id]` Get all the admins or a specific one by providing the ID in the URI.
- `POST /api/v1/admins` Provide the new admin JSON in the request body to insert a new record.
- `PUT /api/v1/admins/:id` Provide the updated admin JSON in the request body to update an existing record. The ID in the URI is required.
- `DELETE /api/v1/admins/:id` Remove an existing admin record.
**Note: The `password` field is optional and should only be provided when creating (POST) or updating (PUT) a record.**
### Providers
**Resource JSON**
```
{
"id": 1,
"firstName": "Chris",
"lastName": "Doe",
"email": "chris@example.org",
"mobile": "+10000000000",
"phone": "+10000000000",
"address": "Test Street 1A",
"city": "Some Place",
"state": "Some State",
"zip": "12345",
"timezone": "UTC",
"language": "english",
"notes": "This is a test provider.",
"services": [
1,
5,
9
],
"settings":{
"username": "chrisdoe",
"password": "Password@123",
"notifications": true,
"googleSync": false,
"googleCalendar": null,
"googleToken": null,
"syncFutureDays": 90,
"syncPastDays": 30,
"calendarView": "default",
"workingPlan":{
"monday":{
"start": "09:00",
"end": "18:00",
"breaks":[
{
"start": "14:30",
"end": "15:00"
}
]
},
"tuesday":{
"start": "09:00",
"end": "18:00",
"breaks":[
{
"start": "14:30",
"end": "15:00"
}
]
},
"wednesday": null,
"thursday":{
"start": "09:00",
"end": "18:00",
"breaks":[
{
"start": "14:30",
"end": "15:00"
}
]
},
"friday": {
"start": "09:00",
"end": "18:00",
"breaks": [
{
"start": "14:30",
"end": "15:00"
}
]
},
"saturday": null,
"sunday": null
},
"workingPlanExceptions": {
"2020-01-01": {
"start": "08:00",
"end": "20:00",
"breaks": [
{
"start": "12:00",
"end": "14:00"
}
]
}
}
}
}
```
- `GET /api/v1/providers[/:id]` Get all the providers or a specific one by providing the ID in the URI.
- `POST /api/v1/providers` Provide the new provider JSON in the request body to insert a new record.
- `PUT /api/v1/providers/:id` Provide the updated provider JSON in the request body to update an existing record. The ID in the URI is required.
- `DELETE /api/v1/providers/:id` Remove an existing provider record.
**Note: The `password` field is optional and should only be provided when creating (POST) or updating (PUT) a record.**
### Secretaries
**Resource JSON**
```
{
"id": 1,
"firstName": "Jessy",
"lastName": "Doe",
"email": "jessy@example.org",
"mobile": "+10000000000",
"phone": "+10000000000",
"address": "Test Street 1A",
"city": "Some Place",
"state": "Some State",
"zip": "12345",
"timezone": "UTC",
"language": "english",
"notes": "This is a test secretary.",
"providers": [
53,
17
],
"settings":{
"username":"jessydoe",
"password":"Password@123",
"notifications": true,
"calendarView": "default"
}
}
```
- `GET /api/v1/secretaries[/:id]` Get all the secretaries or a specific one by providing the ID in the URI.
- `POST /api/v1/secretaries` Provide the new secretary JSON in the request body to insert a new record.
- `PUT /api/v1/secretaries/:id` Provide the updated secretary JSON in the request body to update an existing record. The ID in the URI is required.
- `DELETE /api/v1/secretaries/:id` Remove an existing secretary record.
**Note: The `password` field is optional and should only be provided when creating (POST) or updating (PUT) a record.**
### Settings
**Resource JSON**
```
{
"name": "book_advance_timeout",
"value": "100"
}
```
**Requests**
- `GET /api/v1/settings[/:name]` Get all the settings or a specific one by providing the setting name in the URI.
- `PUT /api/v1/settings/:name` Insert or update a setting in the database. Provide a snake_case name in order to keep the conventions.
- `DELETE /api/v1/settings/:name` Remove a setting from the database. **Notice:** Be careful when removing settings that are required by the application because this will cause error later on.
## API Roadmap
Although the current state should be sufficient for working with the application data there are some other features of that will make the consume more flexible and powerful. These will be added gradually with the future releases of Easy!Appointments.
[ ] Add auto-generated links whenever external resource IDs are provided.
[ ] Add pagination header links when the client provides pagination parameters.
[ ] Add support for sub-resourcing e.g. /api/v1/customers/:id/appointments must return all the appointments of a specific customer.
[ ] Add custom filtering parameters e.g. /api/v1/appointments?book=>2016-07-10
[ ] Improved exception handling.
Feel free to make pull requests if you have the time to develop one of those.
## Troubleshooting
### Authorization Issues
If your server runs PHP through FastCGI you will the authorization will not work because the `Authorization` header is not available to the PHP scripts. You can easily fix this by applying the following adjustments depending your server software:
### Apache
Add the following code snippet to an `.htaccess` file in the installation root directory if you have `mod_rewrite` installed and enabled:
```
RewriteEngine on
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
```
[[Source]](http://stackoverflow.com/a/22554102/1718162)
Add the following code snippet to an `.htaccess` file in the installation root directory if you have `mod_setenvif` installed and enabled:
```
SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
```
[[Source]](http://stackoverflow.com/a/27229807/1718162)
### NGINX
Add the following code snippet to the NGINX `.conf` file:
```
fastcgi_param PHP_AUTH_USER $remote_user;
fastcgi_param PHP_AUTH_PW $http_authorization;
```
[[Source]](http://serverfault.com/a/520943)
*This document applies to Easy!Appointments v1.5.1.*
[Back](readme.md)

136
docs/update-guide.md Normal file
View File

@ -0,0 +1,136 @@
# Update Guide
This page will guide you through the update procedure of your Easy!Appointments installation. You will need to follow the steps below in order to have successful results.
If you get a `500 Internal Server Error` message then you must check the error log files, located in the storage/logs directory.
Before you start following the steps below, make sure you **backup** your database and files.
### Updating from v1.4.x to v1.5.x
###### Step 1: Update your Easy!Appointments files
Replace all files and directories in your installation directory (keep root config.php).
> Note: If you have any custom developed files in these directories, please make copies of them first.
###### Step 2: Run the database migrations
Database migrations will bring your database structure to the latest state.
**Browser**
Open your browser to the Easy!Appointments installation URL, login to the backend and type in the browser address the following URL to complete the database upgrade: `https://url/to/easyappointments/folder/index.php/backend/update`
**Console**
If you have console access to your server then head to the installation directory and run `php index.php console migrate`.
### Updating from v1.3.x to v1.4.x
###### Step 1: Update your Easy!Appointments files
Replace all files and directories in your installation directory.
> Note: If you have any custom developed files in these directories, please make copies of them first.
###### Step 2: Run the database migrations
Database migrations will bring your database structure to the latest state.
**Browser**
Open your browser to the Easy!Appointments installation URL, login to the backend and type in the browser address the following URL to complete the database upgrade: `https://url/to/easyappointments/folder/index.php/backend/update`
**Console**
If you have console access to your server then head to the installation directory and run `php index.php console migrate`.
###### Step 3: Remove unnecessary files
The following directories are not needed:
* /system
The following files are not needed:
* /autoload.php
### Updating from v1.2.x to v1.3.x
###### Step 1: Update your Easy!Appointments files
Replace all files and directories in your installation directory.
> Note: If you have any custom developed files in these directories, please make copies of them first.
###### Step 2: Run the database migrations
Database migrations will bring your database structure to the latest state.
**Browser**
Open your browser to the Easy!Appointments installation URL, login to the backend and type in the browser address the following URL to complete the database upgrade: `https://url/to/easyappointments/folder/index.php/backend/update`
### Updating from v1.2.x to v1.3.x
###### Step 1: Update your Easy!Appointments files
Replace all files and directories in your installation directory.
> Note: If you have any custom developed files in these directories, please make copies of them first.
###### Step 2: Run the database migrations
Database migrations will bring your database structure to the latest state.
**Browser**
Open your browser to the Easy!Appointments installation URL, login to the backend and type in the browser address the following URL to complete the database upgrade: `https://url/to/easyappointments/folder/index.php/backend/update`
### Updating from v1.1.x to v1.2.x
###### Step 1: Update your Easy!Appointments files
Replace all files and directories in your installation directory.
> Note: If you have any custom developed files in these directories, please make copies of them first.
###### Step 2: Run the database migrations
Database migrations will bring your database structure to the latest state.
**Browser**
Open your browser to the Easy!Appointments installation URL, login to the backend and type in the browser address the following URL to complete the database upgrade: `https://url/to/easyappointments/folder/index.php/backend/update`
###### Step 3: Make storage writable
Version v1.2.x introduces two new folders in the root directory of the project, the "engine" and the "storage" directory. **Ensure that the storage directory is writable and has the correct permissions.**
### Updating from v1.0.x to v1.1.x
###### Step 1: Update your Easy!Appointments files
Replace all files and directories in your installation directory.
> Note: If you have any custom developed files in these directories, please make copies of them first.
###### Step 2: Run the database migrations
Database migrations will bring your database structure to the latest state.
**Browser**
Open your browser to the Easy!Appointments installation URL, login to the backend and type in the browser address the following URL to complete the database upgrade: `https://url/to/easyappointments/folder/index.php/backend/update`
###### Step 3: Migrate the configuration.php values
Use the data of the old `configuration.php` file in the new `config.php`.
*This document applies to Easy!Appointments v1.5.1.*
[Back](readme.md)