Add client_get_by_groupid in remote library
Hello,
I searched inside the code of the API and I didn't find a function that returns the client from the group ID. Note that The contrary is possible with client_get_groupid.
I wrote an implementation in interface/lib/classes/remote.d/client.inc.php
:
public function client_get_by_groupid($session_id, $group_id)
{
global $app;
if(!$this->checkPerm($session_id, 'client_get_id')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$group_id = $app->functions->intval($group_id);
$rec = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = ?", $group_id);
if(isset($rec['client_id'])) {
$client_id = $app->functions->intval($rec['client_id']);
return $this->client_get($session_id, $client_id);
} else {
throw new SoapFault('no_group_found', 'There is no client for this group ID.');
return false;
}
}
I didn't know how to handle the checkPerm, so I copy/past from client_get_id
.