NEW Category - API - Add type list (#38207)

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
Alexandre SPANGARO 2026-05-13 14:26:29 +02:00 committed by GitHub
parent 29e01f3aee
commit 0ddc99bc32
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,9 +1,10 @@
<?php
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2024 Jose MARTINEZ <jose.martinez@pichinov.com>
* Copyright (C) 2024 Jose Martinez <jose.martinez@pichinov.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2025 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2026 Alexandre Spangaro <alexandre@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -182,6 +183,26 @@ class Categories extends DolibarrApi
return $obj_ret;
}
/**
* List categories types
*
* Get a list of type of categories according to filters
*
* @return array<string, string> Array of category types
* @url GET /types
*
* @throws RestException
*/
public function getTypes()
{
if (!DolibarrApiAccess::$user->hasRight('categorie', 'lire')) {
throw new RestException(403);
}
return Categorie::$MAP_TYPE_TITLE_AREA;
}
/**
* Create category object
*