add dolibarr api skills for read-only inspection
First two of an expected family of dolibarr-* skills: - dolibarr/: platform reference — DOLAPIKEY auth, the voir_tous ACL trap, endpoint catalogue, the dol-curl.sh wrapper, .env credentials layout (gitignored, mode 600). Every future workflow skill depends on this one. - dolibarr-invoice-audit/: first workflow — list KissMetrics invoices, audit one invoice end-to-end (JSON facts + PDF mandatory-mention checklist against the French legal corpus), audit the KissMetrics thirdparty record. Live captures in examples/ include real audit findings to surface to the Arcodange × KissMetrics cohort review: PDFs are missing capital social, L.441-10 penalties, 40 € indemnity, L.123-22 / R.123-237; KissMetrics thirdparty has no EIN (idprof1..6 all empty); static/config/company.json holds placeholder values and a wrong forme juridique (claims SAS, the real Dolibarr is SARL). .gitignore hardened with *.credentials, secrets/, *.key, and an explicit .claude/skills/**/.env pattern. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
56
.claude/skills/dolibarr/README.md
Normal file
56
.claude/skills/dolibarr/README.md
Normal file
@@ -0,0 +1,56 @@
|
||||
# dolibarr — one-time setup
|
||||
|
||||
Skill body: [SKILL.md](SKILL.md). This README is the human-facing setup checklist.
|
||||
|
||||
## 1. Create `.env` (mode 600, never committed)
|
||||
|
||||
```bash
|
||||
cat > .claude/skills/dolibarr/.env <<'EOF'
|
||||
DOLIBARR_URL=https://erp.arcodange.lab
|
||||
DOLIBARR_API_KEY=<get from Dolibarr UI: Users → ai_agent → API key>
|
||||
DOLIBARR_USER=ai_agent
|
||||
DOLIBARR_PASSWORD=<the ai_agent password, only needed for occasional UI login>
|
||||
EOF
|
||||
chmod 600 .claude/skills/dolibarr/.env
|
||||
```
|
||||
|
||||
Verify it's gitignored:
|
||||
|
||||
```bash
|
||||
git check-ignore .claude/skills/dolibarr/.env # should print the path
|
||||
```
|
||||
|
||||
## 2. Grant `ai_agent` the four `voir_tous` permission flags
|
||||
|
||||
`ai_agent` is read-only by design. But Dolibarr's per-record ACL silently filters out invoices and thirdparties unless the `voir_tous` (see-all) flags are ticked. Without them, `/invoices` returns `[]` and `/thirdparties` returns 404 — looks like an empty database.
|
||||
|
||||
In the Dolibarr UI (https://erp.arcodange.lab/ → **Setup → Users & Groups → `ai_agent` → Permissions**), tick:
|
||||
|
||||
- [ ] **Tiers** → Lire les tiers
|
||||
- [ ] **Tiers** → Voir tous les tiers (et pas seulement ceux liés à l'utilisateur courant)
|
||||
- [ ] **Factures** → Lire les factures
|
||||
- [ ] **Factures** → Voir toutes les factures (et pas seulement celles liées à l'utilisateur courant)
|
||||
|
||||
Save. Future modules used by `dolibarr-*` sibling skills (Paiements, Produits, …) need the same treatment.
|
||||
|
||||
## 3. Quick-start test
|
||||
|
||||
```bash
|
||||
./.claude/skills/dolibarr/scripts/dol-curl.sh /users/info | jq -r .login
|
||||
# → ai_agent
|
||||
./.claude/skills/dolibarr/scripts/dol-curl.sh /status
|
||||
# → {"success":{"code":200,"dolibarr_version":"22.0.4",...}}
|
||||
./.claude/skills/dolibarr/scripts/dol-curl.sh /thirdparties/1 | jq '{ref, country_code, town}'
|
||||
# → {"ref":"KissMetrics","country_code":"US","town":"St. Petersburg"}
|
||||
```
|
||||
|
||||
If the third one returns HTTP 403 `Access not allowed for login ai_agent on this thirdparty`, the `voir_tous` flags from step 2 are missing.
|
||||
|
||||
## 4. Rotating the API key
|
||||
|
||||
If the key leaks: Dolibarr UI → Users → `ai_agent` → API key → **Generate new** → copy the new value into `.env`. No other change needed; every `dolibarr-*` skill picks it up via `dol-curl.sh`.
|
||||
|
||||
## Pointers
|
||||
|
||||
- Full skill body, endpoint catalogue, gotchas: [SKILL.md](SKILL.md).
|
||||
- First workflow skill that depends on this one: [../dolibarr-invoice-audit/SKILL.md](../dolibarr-invoice-audit/SKILL.md).
|
||||
139
.claude/skills/dolibarr/SKILL.md
Normal file
139
.claude/skills/dolibarr/SKILL.md
Normal file
@@ -0,0 +1,139 @@
|
||||
---
|
||||
name: dolibarr
|
||||
description: Reference + connection layer for the Arcodange Dolibarr ERP REST API at https://erp.arcodange.lab/. Documents authentication via DOLAPIKEY, the read-only `ai_agent` account's permission requirements (the `voir_tous` ACL trap that returns empty arrays or 404s instead of 403s on listing endpoints), the credentials layout at `.claude/skills/dolibarr/.env`, the `scripts/dol-curl.sh` wrapper, the catalogue of useful read endpoints (invoices, thirdparties, documents/download, products, status, users/info), and the common gotchas (mode-as-int, paye-vs-status, empty-vs-404-vs-403, unix-epoch dates). Use when setting up the connection, debugging an API call, looking up an endpoint, decoding a permission error, or as a dependency referenced by any `dolibarr-*` workflow skill. SKIP for Dolibarr admin / Helm chart / Ansible config (covered by `chart/` + `ansible/`), for any ERP other than Arcodange's, and for specific business workflows that have their own `dolibarr-<topic>` skill.
|
||||
requires:
|
||||
bins: ["curl", "jq", "python3"]
|
||||
auth: true
|
||||
---
|
||||
|
||||
# dolibarr — Arcodange ERP API platform reference
|
||||
|
||||
This is the **base skill** for talking to the Arcodange Dolibarr instance from Claude Code. It documents the connection, the permissions, the endpoint catalogue, and the gotchas. **Each business workflow lives in its own `dolibarr-<topic>` sibling skill** that depends on this one — V1 ships `dolibarr-invoice-audit` for the KissMetrics audit; future siblings will follow the same pattern (e.g. `dolibarr-payments-state`, `dolibarr-tva-reconciliation`).
|
||||
|
||||
The API key for `ai_agent` is **read-only by design**. Never attempt writes from any `dolibarr-*` skill — use the Dolibarr UI directly for corrections.
|
||||
|
||||
## Quick start
|
||||
|
||||
From the repo root:
|
||||
|
||||
```bash
|
||||
./.claude/skills/dolibarr/scripts/dol-curl.sh /users/info | jq -r .login
|
||||
# → ai_agent
|
||||
```
|
||||
|
||||
If you see `ai_agent`, auth works. If not, check `.env` (next section) and `dol-curl.sh`'s error message.
|
||||
|
||||
For a liveness check that needs no auth:
|
||||
|
||||
```bash
|
||||
curl -s https://erp.arcodange.lab/api/index.php/status | jq .
|
||||
# → {"success":{"code":200,"dolibarr_version":"22.0.4",...}}
|
||||
```
|
||||
|
||||
## Credentials
|
||||
|
||||
Schema of `.claude/skills/dolibarr/.env` (mode **600**, gitignored):
|
||||
|
||||
```
|
||||
DOLIBARR_URL=https://erp.arcodange.lab
|
||||
DOLIBARR_API_KEY=<rotatable api key for ai_agent>
|
||||
DOLIBARR_USER=ai_agent
|
||||
DOLIBARR_PASSWORD=<used only for browser/UI login, very rarely>
|
||||
```
|
||||
|
||||
The DOLAPIKEY is the only secret needed for API calls. `DOLIBARR_USER`/`DOLIBARR_PASSWORD` are kept here only so the operator has them at hand if they need to log into the Dolibarr UI to fix permissions.
|
||||
|
||||
**Rules**:
|
||||
- `chmod 600 .env`. Verify with `stat -f %Lp .env` → `600`.
|
||||
- Never commit. The root `.gitignore` already excludes `.env` at any depth; redundant patterns (`*.credentials`, `.claude/skills/**/.env`) belt-and-braces it.
|
||||
- Never paste the key into chat. If a key leaks, rotate it from the Dolibarr UI: `Users → ai_agent → API key → Generate new`.
|
||||
- Every sibling `dolibarr-*` skill sources this file via `../dolibarr/.env`. There is exactly one copy.
|
||||
|
||||
## Permission gotcha — read this first
|
||||
|
||||
Dolibarr enforces TWO layers of access:
|
||||
1. Per-API-endpoint permissions (does the user's role allow `/invoices`?).
|
||||
2. Per-record ACL (can this user see THIS invoice/thirdparty?).
|
||||
|
||||
Layer 2 is the trap. When `ai_agent` has the endpoint permission but **not** the `voir_tous` flag, listing endpoints silently filter rows out:
|
||||
|
||||
- `GET /invoices` returns `[]` with HTTP **200** (looks like "no invoices exist").
|
||||
- `GET /thirdparties` returns HTTP **404** with `"No third parties found"` (looks like "no thirdparties exist").
|
||||
- `GET /thirdparties/{id}` returns HTTP **403** with `"Access not allowed for login ai_agent on this thirdparty"` (this is the only honest error).
|
||||
|
||||
**Diagnostic recipe.** If a listing endpoint returns empty/404 *while you expect data*:
|
||||
|
||||
```bash
|
||||
./scripts/dol-curl.sh /thirdparties/1
|
||||
```
|
||||
|
||||
If you get a 403 with `Access not allowed`, the ACL is the cause (saved as a reference at [examples/acl_403_thirdparty.json](examples/acl_403_thirdparty.json)). **Do not retry the call blindly.** Fix the permissions, then retest.
|
||||
|
||||
**Fix.** In the Dolibarr UI (https://erp.arcodange.lab/ → Setup → Users & Groups → `ai_agent` → Permissions), tick:
|
||||
|
||||
- **Tiers** → Lire les tiers
|
||||
- **Tiers** → Voir tous les tiers (et pas seulement ceux liés à l'utilisateur courant)
|
||||
- **Factures** → Lire les factures
|
||||
- **Factures** → Voir toutes les factures (et pas seulement celles liées à l'utilisateur courant)
|
||||
|
||||
Add the equivalent flags for any new module a future `dolibarr-*` skill needs (Paiements, Produits, …). The `ai_agent` user has no UI access by default, so `voir_tous` is the right grant — there's no sales-rep relationship to honor.
|
||||
|
||||
## Endpoint catalogue
|
||||
|
||||
Read-only endpoints we've validated against this instance. Live captures are under [examples/](examples/).
|
||||
|
||||
| Endpoint | HTTP | Purpose | Key params / gotchas | Example |
|
||||
|------------------------------------------------|------|--------------------------------------|------------------------------------------------------------------|---------|
|
||||
| `GET /status` | 200 | Liveness + Dolibarr version | No auth needed | [status.json](examples/status.json) |
|
||||
| `GET /users/info` | 200 | Current API user (auth sanity) | Returns `login`, `id`, `rights` tree | [users_info.json](examples/users_info.json) |
|
||||
| `GET /invoices` | 200 | List invoices | `limit`, `sortfield=t.datef`, `sortorder=DESC`, `status=draft\|unpaid\|paid`, `sqlfilters` | [invoices_list.json](examples/invoices_list.json) |
|
||||
| `GET /invoices/{id}` | 200 | Invoice detail | `paye=1` is the canonical "paid" flag | [invoice_detail.json](examples/invoice_detail.json) |
|
||||
| `GET /thirdparties` | 200 | List thirdparties | `mode` MUST be integer (`mode=1` = customers). String fails 400. | (use `/{id}` below) |
|
||||
| `GET /thirdparties/{id}` | 200 | Thirdparty detail | KissMetrics is `id=1` in this instance | [thirdparty_km.json](examples/thirdparty_km.json) |
|
||||
| `GET /products` / `/products/{id}` | 200 | Product catalogue | `KM-audit` is `id=1` | — |
|
||||
| `GET /documents/download` | 200 | Download a stored document as base64 | `modulepart=facture&original_file=<REF>/<REF>.pdf` (URL-encode slashes). Returns `{filename, content-type, filesize, content}` with `content` base64. | [document_download_meta.json](examples/document_download_meta.json) |
|
||||
|
||||
Not available on this account (intentionally): `/setup/modules` (admin-only), `/invoices/templates` (requires a path arg — different route shape; V2).
|
||||
|
||||
## The `dol-curl.sh` wrapper
|
||||
|
||||
[scripts/dol-curl.sh](scripts/dol-curl.sh) is a thin wrapper used by this skill and every sibling. It:
|
||||
|
||||
- Sources `../.env` (relative to itself), so it works regardless of the caller's CWD.
|
||||
- Fails loudly if `.env` is missing or `DOLIBARR_URL` / `DOLIBARR_API_KEY` is unset.
|
||||
- Prepends `DOLAPIKEY` and `Accept: application/json` headers + a 30s timeout.
|
||||
- Prints the response body to stdout.
|
||||
- On HTTP ≥ 400, also prints `dol-curl.sh: HTTP <code> on <path>` to stderr and exits 1 — so `set -e` in caller scripts surfaces the failure.
|
||||
|
||||
```bash
|
||||
# Examples
|
||||
./scripts/dol-curl.sh /users/info | jq .login
|
||||
./scripts/dol-curl.sh '/invoices?limit=5&sortfield=t.datef&sortorder=DESC' | jq '.[].ref'
|
||||
./scripts/dol-curl.sh /invoices/12 | jq '{ref, paye, total_ht, last_main_doc}'
|
||||
./scripts/dol-curl.sh '/documents/download?modulepart=facture&original_file=FAC002-CL0001002%2FFAC002-CL0001002.pdf' \
|
||||
| jq -r .content | base64 -d > /tmp/inv.pdf
|
||||
```
|
||||
|
||||
## Common gotchas
|
||||
|
||||
- **`mode` is an integer.** `?mode=1` works; `?mode=customer` → HTTP 400 `Invalid value specified for mode`.
|
||||
- **Empty list vs 404 vs 403.** `/invoices` returns `[]` (200) on empty/permission-filtered. `/thirdparties` returns 404 `"No third parties found"`. `/thirdparties/{id}` returns 403 if the ACL hides the row. All three can mean "no permission" — the diagnostic is to hit `/thirdparties/1` directly (see Permission gotcha above).
|
||||
- **Dates are unix epoch (seconds).** `.date`, `.datef`, `.date_lim_reglement`, `.tms` are integers.
|
||||
```bash
|
||||
python3 -c "import datetime,sys; print(datetime.datetime.fromtimestamp(int(sys.argv[1])))" 1771887600
|
||||
# → 2026-02-24 00:00:00
|
||||
```
|
||||
- **`paye` is the paid flag, `status` is the workflow state.** `status=2` means "validated", `paye=1` means "fully paid". They're independent — a status-2 invoice can still be unpaid.
|
||||
- **`last_main_doc` paths** are relative to Dolibarr's document root. For `/documents/download`, pass `modulepart=facture` + URL-encoded `original_file=<dir>/<file>` (encode the `/`).
|
||||
- **`array_options=[]` vs `{}`.** Dolibarr returns `[]` when no extrafields are set and `{}` when there are some. Treat both as "no custom fields" in Python.
|
||||
|
||||
## Pointers
|
||||
|
||||
- Workflow skill for invoice + thirdparty audits: [dolibarr-invoice-audit](../dolibarr-invoice-audit/SKILL.md).
|
||||
- Future workflow skills follow the `dolibarr-<topic>` convention. Each one depends on this skill for connection + permissions + endpoint reference; each one keeps its triggers focused on its specific business workflow.
|
||||
|
||||
## Out of scope
|
||||
|
||||
- **Writes.** The `ai_agent` key is read-only by design. For corrections (edit a thirdparty, void an invoice, fix a mention), use the Dolibarr UI.
|
||||
- **Admin endpoints.** `/setup/*` is gated to admins or to logins listed in `API_LOGINS_ALLOWED_FOR_GET_MODULES`; not available to `ai_agent`.
|
||||
- **Helm chart / Ansible / Kubernetes operations.** Covered by `chart/`, `ansible/`, and the project root `README.md`.
|
||||
25
.claude/skills/dolibarr/examples/acl_403_thirdparty.json
Normal file
25
.claude/skills/dolibarr/examples/acl_403_thirdparty.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"_captured_when": "2026-05-28, before the four voir_tous permission flags were ticked on ai_agent. Kept here as the reference signature of the ACL trap. Re-occurrence means the permissions regressed.",
|
||||
"_curl": "curl -H 'DOLAPIKEY: <key>' https://erp.arcodange.lab/api/index.php/thirdparties/1",
|
||||
"_http_status": 403,
|
||||
"error": {
|
||||
"code": 403,
|
||||
"message": "Forbidden: Access not allowed for login ai_agent on this thirdparty"
|
||||
},
|
||||
"debug": {
|
||||
"source": "api_thirdparties.class.php:2403 at call stage",
|
||||
"stages": {
|
||||
"success": [
|
||||
"get",
|
||||
"route",
|
||||
"negotiate",
|
||||
"authenticate",
|
||||
"validate"
|
||||
],
|
||||
"failure": [
|
||||
"call",
|
||||
"message"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"filename": "FAC002-CL0001002.pdf",
|
||||
"content-type": "application/pdf",
|
||||
"filesize": 62345,
|
||||
"content": "JVBERi0xLjcKJeLjz9MKNiAwIG9iago8PCAvVHlwZSAvUGFnZSAvUGFyZW50IDEgMCBSIC9MYXN0TW9kaWZpZWQgKEQ6MjAyNjAzMTMxNTIxNTcrMDEnMDAn...[truncated for repo; 62345-byte PDF]",
|
||||
"encoding": "base64"
|
||||
}
|
||||
273
.claude/skills/dolibarr/examples/invoice_detail.json
Normal file
273
.claude/skills/dolibarr/examples/invoice_detail.json
Normal file
@@ -0,0 +1,273 @@
|
||||
{
|
||||
"module": null,
|
||||
"id": "12",
|
||||
"entity": "1",
|
||||
"import_key": null,
|
||||
"array_options": [],
|
||||
"array_languages": null,
|
||||
"contacts_ids": [],
|
||||
"contacts_ids_internal": null,
|
||||
"linkedObjectsIds": [],
|
||||
"fk_project": null,
|
||||
"contact_id": null,
|
||||
"user": null,
|
||||
"origin_type": null,
|
||||
"origin_id": null,
|
||||
"ref": "FAC002-CL0001002",
|
||||
"ref_ext": null,
|
||||
"statut": "2",
|
||||
"status": "2",
|
||||
"country_id": null,
|
||||
"country_code": null,
|
||||
"state_id": null,
|
||||
"region_id": null,
|
||||
"mode_reglement_id": "2",
|
||||
"cond_reglement_id": "10",
|
||||
"demand_reason_id": null,
|
||||
"transport_mode_id": null,
|
||||
"shipping_method_id": null,
|
||||
"shipping_method": null,
|
||||
"fk_multicurrency": "0",
|
||||
"multicurrency_code": "EUR",
|
||||
"multicurrency_tx": "1.00000000",
|
||||
"multicurrency_total_ht": "5100.00000000",
|
||||
"multicurrency_total_tva": "0.00000000",
|
||||
"multicurrency_total_localtax1": null,
|
||||
"multicurrency_total_localtax2": null,
|
||||
"multicurrency_total_ttc": "5100.00000000",
|
||||
"last_main_doc": "facture/FAC002-CL0001002/FAC002-CL0001002.pdf",
|
||||
"fk_account": "2",
|
||||
"note_public": null,
|
||||
"note_private": "Généré depuis la facture modèle récurrente Kiss Metrics Invoice",
|
||||
"total_ht": "5100.00000000",
|
||||
"total_tva": "0.00000000",
|
||||
"total_localtax1": "0.00000000",
|
||||
"total_localtax2": "0.00000000",
|
||||
"total_ttc": "5100.00000000",
|
||||
"lines": [
|
||||
{
|
||||
"module": null,
|
||||
"id": "12",
|
||||
"entity": null,
|
||||
"import_key": null,
|
||||
"array_options": [],
|
||||
"array_languages": null,
|
||||
"contacts_ids": null,
|
||||
"contacts_ids_internal": null,
|
||||
"linkedObjectsIds": null,
|
||||
"origin_type": null,
|
||||
"origin_id": null,
|
||||
"ref": "KM-cloud-devops",
|
||||
"ref_ext": "",
|
||||
"statut": null,
|
||||
"status": null,
|
||||
"state_id": null,
|
||||
"region_id": null,
|
||||
"demand_reason_id": null,
|
||||
"transport_mode_id": null,
|
||||
"shipping_method": null,
|
||||
"multicurrency_tx": null,
|
||||
"multicurrency_total_ht": "5100.00000000",
|
||||
"multicurrency_total_tva": "0.00000000",
|
||||
"multicurrency_total_localtax1": null,
|
||||
"multicurrency_total_localtax2": null,
|
||||
"multicurrency_total_ttc": "5100.00000000",
|
||||
"last_main_doc": null,
|
||||
"fk_account": null,
|
||||
"total_ht": "5100.00000000",
|
||||
"total_tva": "0.00000000",
|
||||
"total_localtax1": "0.00000000",
|
||||
"total_localtax2": "0.00000000",
|
||||
"total_ttc": "5100.00000000",
|
||||
"lines": null,
|
||||
"actiontypecode": null,
|
||||
"civility_code": null,
|
||||
"date_creation": null,
|
||||
"date_validation": null,
|
||||
"date_modification": null,
|
||||
"tms": null,
|
||||
"date_cloture": null,
|
||||
"user_author": null,
|
||||
"user_creation": null,
|
||||
"user_creation_id": null,
|
||||
"user_valid": null,
|
||||
"user_validation": null,
|
||||
"user_validation_id": null,
|
||||
"user_closing_id": null,
|
||||
"user_modification": null,
|
||||
"user_modification_id": null,
|
||||
"fk_user_creat": null,
|
||||
"fk_user_modif": null,
|
||||
"specimen": 0,
|
||||
"totalpaid": null,
|
||||
"extraparams": [],
|
||||
"product": null,
|
||||
"cond_reglement_supplier_id": null,
|
||||
"deposit_percent": null,
|
||||
"retained_warranty_fk_cond_reglement": null,
|
||||
"warehouse_id": null,
|
||||
"parent_element": "",
|
||||
"fk_parent_attribute": "",
|
||||
"rowid": "12",
|
||||
"fk_unit": null,
|
||||
"date_debut_prevue": null,
|
||||
"date_debut_reel": null,
|
||||
"date_fin_prevue": null,
|
||||
"date_fin_reel": null,
|
||||
"weight": null,
|
||||
"weight_units": null,
|
||||
"length": null,
|
||||
"length_units": null,
|
||||
"width": null,
|
||||
"width_units": null,
|
||||
"height": null,
|
||||
"height_units": null,
|
||||
"surface": null,
|
||||
"surface_units": null,
|
||||
"volume": null,
|
||||
"volume_units": null,
|
||||
"multilangs": null,
|
||||
"product_type": "1",
|
||||
"fk_product": "2",
|
||||
"desc": "TVA non applicable – Article 259-1 du CGI – Prestation de services localisée hors de France (USA)",
|
||||
"description": "TVA non applicable – Article 259-1 du CGI – Prestation de services localisée hors de France (USA)",
|
||||
"product_ref": "KM-cloud-devops",
|
||||
"product_label": "KissMetrics - Cloud Devops - 1 day",
|
||||
"product_barcode": null,
|
||||
"product_desc": "",
|
||||
"fk_product_type": "1",
|
||||
"qty": "10",
|
||||
"duree": null,
|
||||
"remise_percent": "0",
|
||||
"info_bits": "0",
|
||||
"special_code": "0",
|
||||
"subprice": "510.00000000",
|
||||
"subprice_ttc": null,
|
||||
"tva_tx": "0.0000",
|
||||
"multicurrency_subprice": "510.00000000",
|
||||
"multicurrency_subprice_ttc": null,
|
||||
"label": null,
|
||||
"libelle": "KissMetrics - Cloud Devops - 1 day",
|
||||
"price": null,
|
||||
"vat_src_code": "",
|
||||
"localtax1_tx": "0.0000",
|
||||
"localtax2_tx": "0.0000",
|
||||
"localtax1_type": "0",
|
||||
"localtax2_type": "0",
|
||||
"remise": null,
|
||||
"revenuestamp": null,
|
||||
"date_start_fill": null,
|
||||
"date_end_fill": null,
|
||||
"buy_price_ht": null,
|
||||
"buyprice": null,
|
||||
"pa_ht": "0.00000000",
|
||||
"marge_tx": "",
|
||||
"marque_tx": "100",
|
||||
"fk_user_author": null,
|
||||
"fk_accounting_account": "7",
|
||||
"fk_facture": "12",
|
||||
"fk_parent_line": null,
|
||||
"fk_remise_except": null,
|
||||
"rang": "1",
|
||||
"fk_fournprice": null,
|
||||
"tva_npr": null,
|
||||
"batch": "",
|
||||
"fk_warehouse": "0",
|
||||
"fk_code_ventilation": 0,
|
||||
"date_start": 1769986800,
|
||||
"date_end": 1770937200,
|
||||
"situation_percent": "100",
|
||||
"fk_prev_id": null,
|
||||
"packaging": null
|
||||
}
|
||||
],
|
||||
"actiontypecode": null,
|
||||
"name": null,
|
||||
"lastname": null,
|
||||
"firstname": null,
|
||||
"civility_id": null,
|
||||
"civility_code": null,
|
||||
"date_creation": 1771929906,
|
||||
"date_validation": 1771887600,
|
||||
"date_modification": 1773408117,
|
||||
"tms": null,
|
||||
"date_cloture": null,
|
||||
"user_author": null,
|
||||
"user_creation": null,
|
||||
"user_creation_id": "2",
|
||||
"user_valid": null,
|
||||
"user_validation": null,
|
||||
"user_validation_id": "2",
|
||||
"user_closing_id": null,
|
||||
"user_modification": null,
|
||||
"user_modification_id": null,
|
||||
"fk_user_creat": null,
|
||||
"fk_user_modif": null,
|
||||
"specimen": 0,
|
||||
"totalpaid": 5100,
|
||||
"extraparams": [],
|
||||
"product": null,
|
||||
"cond_reglement_supplier_id": null,
|
||||
"deposit_percent": null,
|
||||
"retained_warranty_fk_cond_reglement": "0",
|
||||
"warehouse_id": null,
|
||||
"title": null,
|
||||
"type": "0",
|
||||
"subtype": null,
|
||||
"fk_soc": null,
|
||||
"socid": "1",
|
||||
"paye": "1",
|
||||
"date": 1771887600,
|
||||
"date_lim_reglement": 1774908000,
|
||||
"cond_reglement_code": "10DENDMONTH",
|
||||
"cond_reglement_label": null,
|
||||
"cond_reglement_doc": "Due in 10 days, end of month",
|
||||
"mode_reglement_code": "VIR",
|
||||
"revenuestamp": "0.00000000",
|
||||
"totaldeposits": null,
|
||||
"totalcreditnotes": null,
|
||||
"sumpayed": "5100.00000000",
|
||||
"sumpayed_multicurrency": null,
|
||||
"sumdeposit": null,
|
||||
"sumdeposit_multicurrency": null,
|
||||
"sumcreditnote": null,
|
||||
"sumcreditnote_multicurrency": null,
|
||||
"remaintopay": "0",
|
||||
"nbofopendirectdebitorcredittransfer": null,
|
||||
"creditnote_ids": [],
|
||||
"stripechargedone": null,
|
||||
"stripechargeerror": null,
|
||||
"description": null,
|
||||
"ref_client": null,
|
||||
"situation_cycle_ref": null,
|
||||
"close_code": null,
|
||||
"close_note": null,
|
||||
"postactionmessages": null,
|
||||
"fk_incoterms": "0",
|
||||
"label_incoterms": null,
|
||||
"location_incoterms": "",
|
||||
"fk_user_author": "2",
|
||||
"fk_user_valid": "2",
|
||||
"datem": 1773408117,
|
||||
"delivery_date": null,
|
||||
"ref_customer": null,
|
||||
"resteapayer": null,
|
||||
"module_source": null,
|
||||
"pos_source": null,
|
||||
"fk_fac_rec_source": "1",
|
||||
"fk_facture_source": null,
|
||||
"line": null,
|
||||
"fac_rec": null,
|
||||
"date_pointoftax": "",
|
||||
"situation_counter": null,
|
||||
"situation_final": "0",
|
||||
"tab_previous_situation_invoice": [],
|
||||
"tab_next_situation_invoice": [],
|
||||
"retained_warranty": "0",
|
||||
"retained_warranty_date_limit": "",
|
||||
"availability_id": null,
|
||||
"date_closing": null,
|
||||
"source": null,
|
||||
"remise_percent": null,
|
||||
"online_payment_url": "https://erp.arcodange.lab/public/payment/newpayment.php?source=invoice&ref=FAC002-CL0001002"
|
||||
}
|
||||
1369
.claude/skills/dolibarr/examples/invoices_list.json
Normal file
1369
.claude/skills/dolibarr/examples/invoices_list.json
Normal file
File diff suppressed because it is too large
Load Diff
7
.claude/skills/dolibarr/examples/status.json
Normal file
7
.claude/skills/dolibarr/examples/status.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"success": {
|
||||
"code": 200,
|
||||
"dolibarr_version": "22.0.4",
|
||||
"access_locked": "0"
|
||||
}
|
||||
}
|
||||
167
.claude/skills/dolibarr/examples/thirdparty_km.json
Normal file
167
.claude/skills/dolibarr/examples/thirdparty_km.json
Normal file
@@ -0,0 +1,167 @@
|
||||
{
|
||||
"module": "societe",
|
||||
"id": "1",
|
||||
"entity": "1",
|
||||
"import_key": null,
|
||||
"array_options": [],
|
||||
"array_languages": null,
|
||||
"contacts_ids": null,
|
||||
"contacts_ids_internal": null,
|
||||
"linkedObjectsIds": null,
|
||||
"canvas": null,
|
||||
"fk_project": null,
|
||||
"contact_id": null,
|
||||
"user": null,
|
||||
"origin_type": null,
|
||||
"origin_id": null,
|
||||
"ref": "KissMetrics",
|
||||
"ref_ext": null,
|
||||
"statut": null,
|
||||
"status": "1",
|
||||
"country_id": "11",
|
||||
"country_code": "US",
|
||||
"state_id": "1167",
|
||||
"region_id": "297",
|
||||
"barcode_type": null,
|
||||
"barcode_type_coder": null,
|
||||
"mode_reglement_id": null,
|
||||
"cond_reglement_id": null,
|
||||
"demand_reason_id": null,
|
||||
"transport_mode_id": null,
|
||||
"shipping_method_id": null,
|
||||
"shipping_method": null,
|
||||
"fk_multicurrency": "0",
|
||||
"multicurrency_code": "",
|
||||
"multicurrency_tx": null,
|
||||
"multicurrency_total_ht": null,
|
||||
"multicurrency_total_tva": null,
|
||||
"multicurrency_total_localtax1": null,
|
||||
"multicurrency_total_localtax2": null,
|
||||
"multicurrency_total_ttc": null,
|
||||
"last_main_doc": null,
|
||||
"fk_account": "0",
|
||||
"note_public": null,
|
||||
"note_private": null,
|
||||
"actiontypecode": null,
|
||||
"name": "KissMetrics",
|
||||
"lastname": null,
|
||||
"firstname": null,
|
||||
"civility_id": null,
|
||||
"civility_code": null,
|
||||
"date_creation": 1769898064,
|
||||
"date_validation": null,
|
||||
"date_modification": 1771926531,
|
||||
"tms": null,
|
||||
"date_cloture": null,
|
||||
"user_author": null,
|
||||
"user_creation": null,
|
||||
"user_creation_id": "1",
|
||||
"user_valid": null,
|
||||
"user_validation": null,
|
||||
"user_validation_id": null,
|
||||
"user_closing_id": null,
|
||||
"user_modification": null,
|
||||
"user_modification_id": "1",
|
||||
"fk_user_creat": null,
|
||||
"fk_user_modif": null,
|
||||
"specimen": 0,
|
||||
"totalpaid": null,
|
||||
"extraparams": [],
|
||||
"product": null,
|
||||
"cond_reglement_supplier_id": null,
|
||||
"deposit_percent": null,
|
||||
"retained_warranty_fk_cond_reglement": null,
|
||||
"warehouse_id": null,
|
||||
"SupplierCategories": [],
|
||||
"prefixCustomerIsRequired": null,
|
||||
"name_alias": "",
|
||||
"phone": null,
|
||||
"phone_mobile": null,
|
||||
"fax": null,
|
||||
"email": "evan@kissmetrics.io",
|
||||
"no_email": null,
|
||||
"skype": null,
|
||||
"twitter": null,
|
||||
"facebook": null,
|
||||
"linkedin": null,
|
||||
"url": null,
|
||||
"barcode": null,
|
||||
"idprof1": "",
|
||||
"idprof2": "",
|
||||
"idprof3": "",
|
||||
"idprof4": "",
|
||||
"idprof5": "",
|
||||
"idprof6": "",
|
||||
"idprof7": null,
|
||||
"idprof8": null,
|
||||
"idprof9": null,
|
||||
"idprof10": null,
|
||||
"socialobject": null,
|
||||
"tva_assuj": "0",
|
||||
"tva_intra": "",
|
||||
"vat_reverse_charge": 0,
|
||||
"localtax1_assuj": null,
|
||||
"localtax1_value": "0.0000",
|
||||
"localtax2_assuj": null,
|
||||
"localtax2_value": "0.0000",
|
||||
"managers": null,
|
||||
"capital": null,
|
||||
"typent_id": "3",
|
||||
"typent_code": "TE_MEDIUM",
|
||||
"effectif": "1 - 5",
|
||||
"effectif_id": "1",
|
||||
"forme_juridique_code": null,
|
||||
"forme_juridique": "",
|
||||
"remise_percent": 0,
|
||||
"remise_supplier_percent": "0",
|
||||
"mode_reglement_supplier_id": null,
|
||||
"transport_mode_supplier_id": null,
|
||||
"fk_prospectlevel": "",
|
||||
"client": "1",
|
||||
"prospect": 0,
|
||||
"fournisseur": "0",
|
||||
"code_client": "CL0001",
|
||||
"code_fournisseur": null,
|
||||
"code_compta_client": "411KISSME",
|
||||
"accountancy_code_customer_general": null,
|
||||
"accountancy_code_customer": null,
|
||||
"code_compta_fournisseur": null,
|
||||
"accountancy_code_supplier_general": null,
|
||||
"accountancy_code_supplier": null,
|
||||
"code_compta_product": null,
|
||||
"stcomm_id": "0",
|
||||
"stcomm_picto": null,
|
||||
"status_prospect_label": "Never contacted",
|
||||
"price_level": null,
|
||||
"outstanding_limit": null,
|
||||
"order_min_amount": null,
|
||||
"supplier_order_min_amount": null,
|
||||
"parent": null,
|
||||
"default_lang": null,
|
||||
"ip": null,
|
||||
"webservices_url": null,
|
||||
"webservices_key": null,
|
||||
"logo": null,
|
||||
"logo_small": null,
|
||||
"logo_mini": null,
|
||||
"logo_squarred": null,
|
||||
"logo_squarred_small": null,
|
||||
"logo_squarred_mini": null,
|
||||
"accountancy_code_sell": "",
|
||||
"accountancy_code_buy": "",
|
||||
"currency_code": null,
|
||||
"fk_warehouse": null,
|
||||
"termsofsale": null,
|
||||
"partnerships": [],
|
||||
"bank_account": null,
|
||||
"code_compta": null,
|
||||
"fk_incoterms": "0",
|
||||
"label_incoterms": null,
|
||||
"location_incoterms": null,
|
||||
"socialnetworks": [],
|
||||
"address": "2850 34th Street North, 307",
|
||||
"zip": "33713",
|
||||
"town": "St. Petersburg",
|
||||
"absolute_discount": "0",
|
||||
"absolute_creditnote": "0"
|
||||
}
|
||||
146
.claude/skills/dolibarr/examples/users_info.json
Normal file
146
.claude/skills/dolibarr/examples/users_info.json
Normal file
@@ -0,0 +1,146 @@
|
||||
{
|
||||
"module": null,
|
||||
"id": "3",
|
||||
"entity": "1",
|
||||
"import_key": null,
|
||||
"array_options": [],
|
||||
"array_languages": null,
|
||||
"contacts_ids": null,
|
||||
"contacts_ids_internal": null,
|
||||
"linkedObjectsIds": null,
|
||||
"canvas": null,
|
||||
"fk_project": null,
|
||||
"contact_id": null,
|
||||
"user": null,
|
||||
"origin_type": null,
|
||||
"origin_id": null,
|
||||
"ref": "3",
|
||||
"ref_ext": null,
|
||||
"statut": "1",
|
||||
"status": "1",
|
||||
"country_id": null,
|
||||
"country_code": "",
|
||||
"state_id": null,
|
||||
"region_id": null,
|
||||
"barcode_type": null,
|
||||
"barcode_type_coder": null,
|
||||
"mode_reglement_id": null,
|
||||
"cond_reglement_id": null,
|
||||
"demand_reason_id": null,
|
||||
"transport_mode_id": null,
|
||||
"shipping_method": null,
|
||||
"fk_multicurrency": null,
|
||||
"multicurrency_code": null,
|
||||
"multicurrency_tx": null,
|
||||
"multicurrency_total_ht": null,
|
||||
"multicurrency_total_tva": null,
|
||||
"multicurrency_total_localtax1": null,
|
||||
"multicurrency_total_localtax2": null,
|
||||
"multicurrency_total_ttc": null,
|
||||
"last_main_doc": null,
|
||||
"fk_account": null,
|
||||
"note_public": "",
|
||||
"note_private": "",
|
||||
"actiontypecode": null,
|
||||
"name": null,
|
||||
"lastname": "AI Agent",
|
||||
"firstname": "",
|
||||
"civility_id": null,
|
||||
"civility_code": "",
|
||||
"date_creation": null,
|
||||
"date_validation": null,
|
||||
"date_modification": null,
|
||||
"tms": null,
|
||||
"date_cloture": null,
|
||||
"user_author": null,
|
||||
"user_creation": null,
|
||||
"user_creation_id": null,
|
||||
"user_valid": null,
|
||||
"user_validation": null,
|
||||
"user_validation_id": null,
|
||||
"user_closing_id": null,
|
||||
"user_modification": null,
|
||||
"user_modification_id": null,
|
||||
"fk_user_creat": null,
|
||||
"fk_user_modif": null,
|
||||
"specimen": 0,
|
||||
"totalpaid": null,
|
||||
"extraparams": [],
|
||||
"product": null,
|
||||
"cond_reglement_supplier_id": null,
|
||||
"deposit_percent": null,
|
||||
"retained_warranty_fk_cond_reglement": null,
|
||||
"warehouse_id": null,
|
||||
"employee": "1",
|
||||
"fullname": null,
|
||||
"gender": null,
|
||||
"birth": "",
|
||||
"email": "",
|
||||
"email_oauth2": null,
|
||||
"personal_email": "",
|
||||
"socialnetworks": [],
|
||||
"job": "AI Agent",
|
||||
"signature": "Claude AI",
|
||||
"office_phone": "",
|
||||
"office_fax": "",
|
||||
"user_mobile": "",
|
||||
"personal_mobile": "",
|
||||
"admin": "0",
|
||||
"login": "ai_agent",
|
||||
"pass_crypted": null,
|
||||
"datec": 1779984197,
|
||||
"datem": 1779977142,
|
||||
"socid": null,
|
||||
"fk_member": null,
|
||||
"fk_user": null,
|
||||
"fk_user_expense_validator": null,
|
||||
"fk_user_holiday_validator": null,
|
||||
"clicktodial_url": null,
|
||||
"clicktodial_login": null,
|
||||
"clicktodial_poste": null,
|
||||
"datelastpassvalidation": "2026-05-28 18:05:42",
|
||||
"datelastlogin": "",
|
||||
"datepreviouslogin": "",
|
||||
"flagdelsessionsbefore": 1779984337,
|
||||
"iplastlogin": null,
|
||||
"ippreviouslogin": null,
|
||||
"datestartvalidity": "",
|
||||
"dateendvalidity": "",
|
||||
"photo": null,
|
||||
"lang": null,
|
||||
"rights": {
|
||||
"user": {
|
||||
"user": {},
|
||||
"self": {},
|
||||
"user_advance": {},
|
||||
"self_advance": {},
|
||||
"group_advance": {}
|
||||
}
|
||||
},
|
||||
"user_group_list": [],
|
||||
"conf": {},
|
||||
"users": [],
|
||||
"parentof": null,
|
||||
"accountancy_code_user_general": "",
|
||||
"accountancy_code": "",
|
||||
"thm": null,
|
||||
"tjm": null,
|
||||
"salary": null,
|
||||
"salaryextra": null,
|
||||
"weeklyhours": null,
|
||||
"color": "ff7f00",
|
||||
"dateemployment": "",
|
||||
"dateemploymentend": "",
|
||||
"default_c_exp_tax_cat": null,
|
||||
"ref_employee": "",
|
||||
"national_registration_number": "",
|
||||
"default_range": null,
|
||||
"fk_warehouse": null,
|
||||
"fk_establishment": null,
|
||||
"label_establishment": null,
|
||||
"usergroup_entity": null,
|
||||
"address": "",
|
||||
"zip": "",
|
||||
"town": "",
|
||||
"url": null
|
||||
}
|
||||
61
.claude/skills/dolibarr/scripts/dol-curl.sh
Executable file
61
.claude/skills/dolibarr/scripts/dol-curl.sh
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env bash
|
||||
# Tiny read-only curl wrapper for the Arcodange Dolibarr API.
|
||||
#
|
||||
# Usage:
|
||||
# dol-curl.sh <path-with-query> # e.g. dol-curl.sh /invoices?limit=5
|
||||
# dol-curl.sh -i <path> # include response headers
|
||||
# dol-curl.sh -o file.json <path> # write body to file
|
||||
#
|
||||
# Reads DOLIBARR_URL and DOLIBARR_API_KEY from the sibling .env file
|
||||
# (.claude/skills/dolibarr/.env), mode 600, gitignored.
|
||||
# Exits non-zero on HTTP >=400 and prints the response body on stderr.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
ENV_FILE="${SCRIPT_DIR}/../.env"
|
||||
|
||||
if [[ ! -f "${ENV_FILE}" ]]; then
|
||||
echo "dol-curl.sh: missing ${ENV_FILE}" >&2
|
||||
echo " Create it with DOLIBARR_URL and DOLIBARR_API_KEY. See dolibarr/README.md." >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC1090
|
||||
set -a; source "${ENV_FILE}"; set +a
|
||||
|
||||
: "${DOLIBARR_URL:?dol-curl.sh: DOLIBARR_URL not set in .env}"
|
||||
: "${DOLIBARR_API_KEY:?dol-curl.sh: DOLIBARR_API_KEY not set in .env}"
|
||||
|
||||
# Last positional arg is the API path; everything before it is passed through to curl.
|
||||
if [[ $# -lt 1 ]]; then
|
||||
echo "dol-curl.sh: missing API path. Example: dol-curl.sh /users/info" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
PASSTHRU=()
|
||||
while [[ $# -gt 1 ]]; do
|
||||
PASSTHRU+=("$1")
|
||||
shift
|
||||
done
|
||||
API_PATH="$1"
|
||||
|
||||
# Two-stage call: capture HTTP code + body separately so we can fail clearly
|
||||
# while still letting the user pipe stdout into jq.
|
||||
BODY_FILE="$(mktemp -t dolcurl.XXXXXX)"
|
||||
trap 'rm -f "${BODY_FILE}"' EXIT
|
||||
|
||||
HTTP_CODE=$(curl -sS \
|
||||
-H "DOLAPIKEY: ${DOLIBARR_API_KEY}" \
|
||||
-H "Accept: application/json" \
|
||||
--max-time 30 \
|
||||
-o "${BODY_FILE}" \
|
||||
-w "%{http_code}" \
|
||||
${PASSTHRU[@]+"${PASSTHRU[@]}"} \
|
||||
"${DOLIBARR_URL}/api/index.php${API_PATH}")
|
||||
|
||||
cat "${BODY_FILE}"
|
||||
if [[ "${HTTP_CODE}" -ge 400 ]]; then
|
||||
echo "dol-curl.sh: HTTP ${HTTP_CODE} on ${API_PATH}" >&2
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user