From 3cac54741da48ae2baa4896d3a39bcf029271f33 Mon Sep 17 00:00:00 2001 From: Xebax Date: Mon, 20 Jun 2016 12:16:19 +0200 Subject: [PATCH] REST API: fix the index() method in Categories. In the Categories class, set all the parameters of the index() method as optional to make this method compatible with the one of the parent class, DolibarrApi. --- htdocs/categories/class/api_categories.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 22c40de0ef9..cab36132944 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -102,7 +102,7 @@ class Categories extends DolibarrApi * * @throws RestException */ - function index($type, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { + function index($type = '', $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { global $db, $conf; $obj_ret = array(); @@ -114,7 +114,10 @@ class Categories extends DolibarrApi $sql = "SELECT s.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie as s"; $sql.= ' WHERE s.entity IN ('.getEntity('categorie', 1).')'; - $sql.= ' AND s.type='.array_search($type,Categories::$TYPES); + if (!empty($type)) + { + $sql.= ' AND s.type='.array_search($type,Categories::$TYPES); + } $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))