diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index 44024b951b3..435f6a7e24e 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -540,10 +540,6 @@ class Members extends DolibarrApi $result = $categories->getListForItem($id, 'member', $sortfield, $sortorder, $limit, $page); - if (empty($result)) { - throw new RestException(404, 'No category found'); - } - if ($result < 0) { throw new RestException(503, 'Error when retrieve category list : '.$categories->error); } diff --git a/htdocs/adherents/class/api_memberstypes.class.php b/htdocs/adherents/class/api_memberstypes.class.php index 5f1a1aec7b6..302270d5c5f 100644 --- a/htdocs/adherents/class/api_memberstypes.class.php +++ b/htdocs/adherents/class/api_memberstypes.class.php @@ -136,9 +136,6 @@ class MembersTypes extends DolibarrApi } else { throw new RestException(503, 'Error when retrieve member type list : '.$this->db->lasterror()); } - if (!count($obj_ret)) { - throw new RestException(404, 'No member type found'); - } return $obj_ret; } diff --git a/htdocs/adherents/class/api_subscriptions.class.php b/htdocs/adherents/class/api_subscriptions.class.php index 9c051ac6a41..77c7a8b933a 100644 --- a/htdocs/adherents/class/api_subscriptions.class.php +++ b/htdocs/adherents/class/api_subscriptions.class.php @@ -133,9 +133,6 @@ class Subscriptions extends DolibarrApi } else { throw new RestException(503, 'Error when retrieve subscription list : '.$this->db->lasterror()); } - if (!count($obj_ret)) { - throw new RestException(404, 'No Subscription found'); - } return $obj_ret; } diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 5ec9c9a34aa..0135fb5c413 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1156,10 +1156,6 @@ class Setup extends DolibarrApi throw new RestException(503, 'Error when retrieving list of extra fields : '.$this->db->lasterror()); } - if (!count($list)) { - throw new RestException(404, 'No extrafield found'); - } - return $list; } diff --git a/htdocs/bom/class/api_boms.class.php b/htdocs/bom/class/api_boms.class.php index 658543e68c3..89633e0ac6e 100644 --- a/htdocs/bom/class/api_boms.class.php +++ b/htdocs/bom/class/api_boms.class.php @@ -182,9 +182,7 @@ class Boms extends DolibarrApi } else { throw new RestException(503, 'Error when retrieve bom list'); } - if (!count($obj_ret)) { - throw new RestException(404, 'No bom found'); - } + return $obj_ret; } diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 5d2a9d0862a..b1d0ff392d6 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -182,9 +182,7 @@ class Categories extends DolibarrApi } else { throw new RestException(503, 'Error when retrieve category list : '.$this->db->lasterror()); } - if (!count($obj_ret)) { - throw new RestException(404, 'No category found'); - } + return $obj_ret; } @@ -342,9 +340,6 @@ class Categories extends DolibarrApi $categories = $this->category->getListForItem($id, $type, $sortfield, $sortorder, $limit, $page); if (!is_array($categories)) { - if ($categories == 0) { - throw new RestException(404, 'No category found for this object'); - } throw new RestException(600, 'Error when fetching object categories', array_merge(array($this->category->error), $this->category->errors)); } return $categories; diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 50fb1882aaf..d1c013bc59c 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -192,9 +192,7 @@ class AgendaEvents extends DolibarrApi } else { throw new RestException(503, 'Error when retrieve Agenda Event list : '.$this->db->lasterror()); } - if (!count($obj_ret)) { - throw new RestException(404, 'No Agenda Event found'); - } + return $obj_ret; } diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 05cb33a17df..be45153fb10 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -245,9 +245,7 @@ class Proposals extends DolibarrApi } else { throw new RestException(503, 'Error when retrieve propal list : '.$this->db->lasterror()); } - if (!count($obj_ret)) { - throw new RestException(404, 'No proposal found'); - } + return $obj_ret; } diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index c5119a51f6e..31daad85e9b 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -259,9 +259,7 @@ class Orders extends DolibarrApi } else { throw new RestException(503, 'Error when retrieve commande list : '.$this->db->lasterror()); } - if (!count($obj_ret)) { - throw new RestException(404, 'No order found'); - } + return $obj_ret; } diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 94de562a3c2..35e81b82f82 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -281,9 +281,7 @@ class Invoices extends DolibarrApi } else { throw new RestException(503, 'Error when retrieve invoice list : '.$this->db->lasterror()); } - if (!count($obj_ret)) { - throw new RestException(404, 'No invoice found'); - } + return $obj_ret; } diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php index 523eb59ea03..51c3d63d412 100644 --- a/htdocs/contrat/class/api_contracts.class.php +++ b/htdocs/contrat/class/api_contracts.class.php @@ -181,9 +181,7 @@ class Contracts extends DolibarrApi } else { throw new RestException(503, 'Error when retrieve contrat list : '.$this->db->lasterror()); } - if (!count($obj_ret)) { - throw new RestException(404, 'No contract found'); - } + return $obj_ret; } diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index ad4be19f012..e734be8efff 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -165,9 +165,6 @@ class Donations extends DolibarrApi } else { throw new RestException(503, 'Error when retrieve donation list : '.$this->db->lasterror()); } - if (!count($obj_ret)) { - throw new RestException(404, 'No donation found'); - } return $obj_ret; } diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index e7e7dc462aa..7372f9f98f8 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -151,9 +151,7 @@ class ExpenseReports extends DolibarrApi } else { throw new RestException(503, 'Error when retrieve Expense Report list : '.$this->db->lasterror()); } - if (!count($obj_ret)) { - throw new RestException(404, 'No Expense Report found'); - } + return $obj_ret; } diff --git a/htdocs/fichinter/class/api_interventions.class.php b/htdocs/fichinter/class/api_interventions.class.php index e9717982c73..114a8613c43 100644 --- a/htdocs/fichinter/class/api_interventions.class.php +++ b/htdocs/fichinter/class/api_interventions.class.php @@ -190,9 +190,7 @@ class Interventions extends DolibarrApi } else { throw new RestException(503, 'Error when retrieve intervention list : '.$this->db->lasterror()); } - if (!count($obj_ret)) { - throw new RestException(404, 'No intervention found'); - } + return $obj_ret; } diff --git a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php index c87c1da87a0..8e4a2cac6e1 100644 --- a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php +++ b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php @@ -109,10 +109,6 @@ class KnowledgeManagement extends DolibarrApi $result = $categories->getListForItem($id, 'knowledgemanagement', $sortfield, $sortorder, $limit, $page); - if (empty($result)) { - throw new RestException(404, 'No category found'); - } - if ($result < 0) { throw new RestException(503, 'Error when retrieve category list : '.join(',', array_merge(array($categories->error), $categories->errors))); } diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index 449312deeab..62ad513d307 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -190,9 +190,7 @@ class MyModuleApi extends DolibarrApi } else { throw new RestException(503, 'Error when retrieving myobject list: '.$this->db->lasterror()); } - if (!count($obj_ret)) { - throw new RestException(404, 'No myobject found'); - } + return $obj_ret; } diff --git a/htdocs/mrp/class/api_mos.class.php b/htdocs/mrp/class/api_mos.class.php index c3900271e42..ff49948d284 100644 --- a/htdocs/mrp/class/api_mos.class.php +++ b/htdocs/mrp/class/api_mos.class.php @@ -180,9 +180,7 @@ class Mos extends DolibarrApi } else { throw new RestException(503, 'Error when retrieve MO list'); } - if (!count($obj_ret)) { - throw new RestException(404, 'No MO found'); - } + return $obj_ret; } diff --git a/htdocs/partnership/class/api_partnerships.class.php b/htdocs/partnership/class/api_partnerships.class.php index c66076c2866..e3ca8f23e2e 100644 --- a/htdocs/partnership/class/api_partnerships.class.php +++ b/htdocs/partnership/class/api_partnerships.class.php @@ -187,9 +187,7 @@ class Partnerships extends DolibarrApi } else { throw new RestException(503, 'Error when retrieving partnership list: '.$this->db->lasterror()); } - if (!count($obj_ret)) { - throw new RestException(404, 'No partnership found'); - } + return $obj_ret; } diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index afa78b10622..4023309ef35 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -277,9 +277,6 @@ class Products extends DolibarrApi } else { throw new RestException(503, 'Error when retrieve product list : '.$this->db->lasterror()); } - if (!count($obj_ret)) { - throw new RestException(404, 'No product found'); - } //if $pagination_data is true the response will contain element data with all values and element pagination with pagination data(total,page,limit) if ($pagination_data) { @@ -601,10 +598,6 @@ class Products extends DolibarrApi $result = $categories->getListForItem($id, 'product', $sortfield, $sortorder, $limit, $page); - if (empty($result)) { - throw new RestException(404, 'No category found'); - } - if ($result < 0) { throw new RestException(503, 'Error when retrieve category list : '.join(',', array_merge(array($categories->error), $categories->errors))); } @@ -953,9 +946,7 @@ class Products extends DolibarrApi } else { throw new RestException(503, 'Error when retrieve product list : '.$this->db->lasterror()); } - if (!count($obj_ret)) { - throw new RestException(404, 'No product found'); - } + return $obj_ret; } @@ -1080,10 +1071,6 @@ class Products extends DolibarrApi $return[] = $this->_filterObjectProperties($this->_cleanObjectDatas($tmp), $properties); } - if (!count($return)) { - throw new RestException(404, 'No product attribute found'); - } - return $return; } @@ -1949,10 +1936,6 @@ class Products extends DolibarrApi } } - if (empty($stockData)) { - throw new RestException(404, 'No stock found'); - } - return array('stock_warehouses'=>$stockData); } diff --git a/htdocs/product/stock/class/api_stockmovements.class.php b/htdocs/product/stock/class/api_stockmovements.class.php index 369d24b9536..1f47339c3c4 100644 --- a/htdocs/product/stock/class/api_stockmovements.class.php +++ b/htdocs/product/stock/class/api_stockmovements.class.php @@ -144,9 +144,7 @@ class StockMovements extends DolibarrApi } else { throw new RestException(503, 'Error when retrieve stock movement list : '.$this->db->lasterror()); } - if (!count($obj_ret)) { - throw new RestException(404, 'No stock movement found'); - } + return $obj_ret; } diff --git a/htdocs/product/stock/class/api_warehouses.class.php b/htdocs/product/stock/class/api_warehouses.class.php index 8056e59ac67..6fa256454b9 100644 --- a/htdocs/product/stock/class/api_warehouses.class.php +++ b/htdocs/product/stock/class/api_warehouses.class.php @@ -150,9 +150,7 @@ class Warehouses extends DolibarrApi } else { throw new RestException(503, 'Error when retrieve warehouse list : '.$this->db->lasterror()); } - if (!count($obj_ret)) { - throw new RestException(404, 'No warehouse found'); - } + return $obj_ret; } diff --git a/htdocs/recruitment/class/api_recruitments.class.php b/htdocs/recruitment/class/api_recruitments.class.php index 526d25c4aa8..a5cc43d6854 100644 --- a/htdocs/recruitment/class/api_recruitments.class.php +++ b/htdocs/recruitment/class/api_recruitments.class.php @@ -226,9 +226,7 @@ class Recruitments extends DolibarrApi } else { throw new RestException(503, 'Error when retrieving jobposition list: '.$this->db->lasterror()); } - if (!count($obj_ret)) { - throw new RestException(404, 'No jobposition found'); - } + return $obj_ret; } @@ -333,9 +331,7 @@ class Recruitments extends DolibarrApi } else { throw new RestException(503, 'Error when retrieving candidature list: '.$this->db->lasterror()); } - if (!count($obj_ret)) { - throw new RestException(404, 'No candidature found'); - } + return $obj_ret; } diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index a91455aabe7..4ea6f184fe7 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -465,10 +465,6 @@ class Contacts extends DolibarrApi $result = $categories->getListForItem($id, 'contact', $sortfield, $sortorder, $limit, $page); - if (empty($result)) { - throw new RestException(404, 'No category found'); - } - if ($result < 0) { throw new RestException(503, 'Error when retrieve category list : '.$categories->error); } diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index 18e8b74aee9..b8e37707138 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -285,9 +285,7 @@ class Tickets extends DolibarrApi } else { throw new RestException(503, 'Error when retrieve ticket list'); } - if (!count($obj_ret)) { - throw new RestException(404, 'No ticket found'); - } + return $obj_ret; } diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index b75cc5339bf..e1424796c63 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -134,9 +134,7 @@ class Users extends DolibarrApi } else { throw new RestException(503, 'Error when retrieve User list : '.$this->db->lasterror()); } - if (!count($obj_ret)) { - throw new RestException(404, 'No User found'); - } + return $obj_ret; } @@ -590,9 +588,7 @@ class Users extends DolibarrApi } else { throw new RestException(503, 'Error when retrieve Group list : '.$this->db->lasterror()); } - if (!count($obj_ret)) { - throw new RestException(404, 'No Group found'); - } + return $obj_ret; }