# Doli Training Management

**Contributors:** oandrade  
**Tags:** dolibarr, training, catalog, integration, formations  
**Requires at least:** 5.8  
**Tested up to:** 6.9  
**Stable tag:** 1.0.1  
**Requires PHP:** 7.4  
**License:** GPLv3 or later  
**License URI:** https://www.gnu.org/licenses/gpl-3.0.html  

> WordPress.org uses **`readme.txt`** as the canonical file for the plugin directory parser. This `README.md` mirrors the same facts for Git developers and adds optional marketing / legal context below.

Embed your Dolibarr Training Management catalog in WordPress via a shortcode and a server-side proxy to your own Dolibarr instance.

## Main features

* Displays a Training Management **training catalog** from your Dolibarr instance inside WordPress.
* Provides an admin **setup screen** (Dolibarr URL + API key) under **Doli Training**.
* Uses an Angular front-end custom element and the shortcode `[doli-training-management]`.
* No calls to the plugin author's servers for catalog data: HTTP requests go only to the **Dolibarr URL you configure**.
* Optional link to create a hosted Training Management / Ma Gestion Cloud trial account (third-party commercial service); not required to use the plugin with your own Dolibarr.
* Self-hosted fonts (Roboto, Material Icons) bundled with the front-end assets — no Google Fonts CDN.
* Front-end scripts load only when the post content contains the shortcode (performance); see FAQ for the override filter.

## Description

**Doli Training Management** connects WordPress to **your** Dolibarr instance (with the Training Management module). Site administrators enter the Dolibarr base URL and API key in the plugin settings. Visitors see the training catalog through the `[doli-training-management]` shortcode.

When setup is incomplete, the shortcode output points administrators to the settings screen.

## Official ownership

This plugin is an official integration for Dolibarr **Training Management**, developed and maintained by **Aplose**, the official publisher of TrainingManagement.

**Official trademarks:**

- **TrainingManagement** — trademark owned by Aplose  
- **Ma Gestion Cloud** — trademark owned by Aplose ([INPI Registration FR5053373](https://data.inpi.fr/marques/FR5053373))  
- **Aplose** — trademark owned by Olivier ANDRADE SANCHEZ ([INPI Registration FR4741208](https://data.inpi.fr/marques/FR4741208))  

**Company information:**

- **Company:** Aplose (100% owned by Olivier ANDRADE SANCHEZ)  
- **Legal information:** [Pappers company profile](https://www.pappers.fr/entreprise/aplose-534906698)  
- **Website:** https://www.ma-gestion-cloud.fr  

## Requirements

This plugin requires:

- A **Dolibarr installation** with **Training Management** installed, or  
- A **Training Management Ma Gestion Cloud** instance (TrainingManagement pre-installed).

**Need a Training Management instance?**  
Create your account on [Ma Gestion Cloud](https://aplose.ma-gestion-cloud.fr/custom/sellyoursaas/myaccount/register.php?origin=backofficelink&plan=MGC0007&country=FR) and get your Dolibarr instance with TrainingManagement pre-installed. **30-day free trial** available.

## Installation

1. Upload the `doli-training-management` folder to `/wp-content/plugins/` or install through the WordPress Plugins screen.  
2. Activate the plugin in WordPress.  
3. Go to **Doli Training** → **Settings** and set your Dolibarr URL and API key.  
   - If you do not have an account yet, the Settings screen includes a link to a hosted trial (same flow as in `readme.txt`).  
4. Add `[doli-training-management]` to a page or post.

## Usage

Add this shortcode anywhere in WordPress (in the **post body** so that assets load automatically):

```text
[doli-training-management]
```

The widget uses the Dolibarr URL and API key from the plugin settings.

## Frequently asked questions

### Where does the plugin send data?

Catalog and inquiry requests are proxied through WordPress `admin-ajax.php` to the **Dolibarr REST API** at the URL you save in settings, using your API key on the server. The plugin does not send that traffic to the plugin author's infrastructure.

### Why do scripts load only on some pages?

Front-end JavaScript and CSS load only when the current singular post content contains the `[doli-training-management]` shortcode (for performance). Use `add_filter( 'doli_training_management_force_enqueue_assets', '__return_true' );` if you embed the shortcode outside post content (advanced).

## Source code and build

The WordPress plugin PHP lives in this package. The front-end is built with **Angular** from TypeScript / HTML / SCSS sources in the author’s development repository.

**Public Angular source repository:** https://git.aplose-dev.fr/aplose/DolibarrTrainingManagement.git

**Shipped JavaScript:** The files under `assets/doli-training-management/browser/` (including `main.js` and `polyfills.js`) are built with **`npm run build:wordpress`** (optimized/minified distribution build). Human-readable TypeScript / HTML / SCSS sources and build tooling are publicly available in the repository above.

**Third-party front-end libraries** (npm): Angular, Angular Material, RxJS, ngx-translate, Zone.js, tslib, and **Fontsource** packages `@fontsource/roboto` and `@fontsource/material-icons` (font files under Apache 2.0 / SIL OFL as per each package). See each package’s `LICENSE` in `node_modules` when developing from source.

From the Angular project root:

1. Install dependencies: `npm ci` (use `npm ci --legacy-peer-deps` if npm reports peer dependency conflicts).  
2. Optimized distribution build (used for WordPress.org package): `npm run build:wordpress`  
3. Optional default production build: `npm run build`  

Output is written to `wp-content/plugins/doli-training-management/assets/doli-training-management/` in this repository layout.

## Screenshots

1. Training catalog embedded on the front end.  
2. Plugin settings (Dolibarr URL and API key).

## Troubleshooting

### Widget is blank / not loading

* Plugin settings contain a valid Dolibarr URL and API key.  
* Assets exist under `assets/doli-training-management/browser/` and load without 404.  
* The page **post content** includes the shortcode (or you forced enqueue with the filter above).  
* Browser console has no JavaScript errors.

### API errors

* Dolibarr endpoints are reachable from the server (WordPress → Dolibarr).  
* API key is correct and active.  
* Training Management features are accessible on your Dolibarr instance.

## Documentation

Administrative docs are available from the WordPress menu: **Doli Training** → **Documentation**.

## Changelog

### 1.0.1

* WordPress.org `readme.txt`, uninstall cleanup, conditional front-end assets, nonce on training inquiry AJAX, admin-only error traces, signup URL fix.

### 1.0.0

* Initial release.
