Skip to content

Commit

Permalink
Update api_memberstypes.class.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ptibogxiv committed Apr 1, 2019
1 parent 22ea6fa commit 2da9cfb
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions htdocs/adherents/class/api_memberstypes.class.php
Expand Up @@ -79,15 +79,14 @@ public function get($id)
*
* @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')"
* @return array Array of member type objects
*
* @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;

Expand All @@ -100,15 +99,6 @@ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $nature = 'all
$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)
Expand Down

0 comments on commit 2da9cfb

Please sign in to comment.