Update api_memberstypes.class.php

This commit is contained in:
ptibogxiv 2019-04-01 20:25:37 +02:00 committed by GitHub
parent 22ea6fa0ab
commit 2da9cfbbe4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,7 +79,6 @@ class MembersTypes extends DolibarrApi
*
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param string $nature Nature of type phy, mor or both (for only both not mor or phy only)
* @param int $limit Limit for list
* @param int $page Page number
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.libelle:like:'SO-%') and (t.subscription:=:'1')"
@ -87,7 +86,7 @@ class MembersTypes extends DolibarrApi
*
* @throws RestException
*/
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $nature = 'all', $limit = 100, $page = 0, $sqlfilters = '')
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{
global $db, $conf;
@ -100,15 +99,6 @@ class MembersTypes extends DolibarrApi
$sql = "SELECT t.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= ' WHERE t.entity IN ('.getEntity('member_type').')';
// Nature
if ($nature != 'all') {
if ($nature == 'both') {
$sql.= ' AND t.morphy IS NULL ';
} else {
$sql.= ' AND (t.morphy IS NULL OR t.morphy = "'.$nature.'")';
}
}
// Add sql filters
if ($sqlfilters)