Fix: missing include api_categories class

This commit is contained in:
Regis Houssin 2017-10-03 13:07:07 +02:00
parent db8d27f0fe
commit f8f4ff6d21
5 changed files with 151 additions and 116 deletions

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2016 Xebax Christy <xebax@wanadoo.fr> /* Copyright (C) 2016 Xebax Christy <xebax@wanadoo.fr>
* Copyright (C) 2017 Regis Houssin <regis.houssin@capnetworks.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -357,4 +358,26 @@ class Members extends DolibarrApi
return $member->subscription($start_date, $amount, 0, '', $label, '', '', '', $end_date); return $member->subscription($start_date, $amount, 0, '', $label, '', '', '', $end_date);
} }
/**
* Get categories for a member
*
* @param int $id ID of member
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Limit for list
* @param int $page Page number
*
* @return mixed
*
* @url GET {id}/categories
*/
function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/api_categories.class.php';
$categories = new Categories();
return $categories->getListForItem($sortfield, $sortorder, $limit, $page, 'member', $id);
}
} }

View File

@ -263,9 +263,13 @@ class Products extends DolibarrApi
* *
* @url GET {id}/categories * @url GET {id}/categories
*/ */
function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
$categories = new Categories(); {
return $categories->getListForItem($sortfield, $sortorder, $limit, $page, 'product', $id); require_once DOL_DOCUMENT_ROOT.'/categories/class/api_categories.class.php';
$categories = new Categories();
return $categories->getListForItem($sortfield, $sortorder, $limit, $page, 'product', $id);
} }
/** /**

View File

@ -333,8 +333,12 @@ class Contacts extends DolibarrApi
* *
* @url GET {id}/categories * @url GET {id}/categories
*/ */
function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/api_categories.class.php';
$categories = new Categories(); $categories = new Categories();
return $categories->getListForItem($sortfield, $sortorder, $limit, $page, 'contact', $id); return $categories->getListForItem($sortfield, $sortorder, $limit, $page, 'contact', $id);
} }

View File

@ -266,8 +266,12 @@ class Thirdparties extends DolibarrApi
* *
* @url GET {id}/categories * @url GET {id}/categories
*/ */
function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/api_categories.class.php';
$categories = new Categories(); $categories = new Categories();
return $categories->getListForItem($sortfield, $sortorder, $limit, $page, 'customer', $id); return $categories->getListForItem($sortfield, $sortorder, $limit, $page, 'customer', $id);
} }