public function get_activities_by_customer($customer_ID)
{
$p = $this->kga['server_prefix'];
$customer_ID = MySQL::SQLValue($customer_ID, MySQL::SQLVALUE_NUMBER);
$query = "SELECT DISTINCT activityID, name, visible\n FROM {$p}activities\n WHERE activityID IN\n (SELECT activityID FROM {$p}timeSheet\n WHERE projectID IN (SELECT projectID FROM {$p}projects WHERE customerID = {$customer_ID}))\n AND trash=0";
$result = $this->conn->Query($query);
if ($result == false) {
$this->logLastError('get_activities_by_customer');
return false;
}
$arr = array();
$i = 0;
if ($this->conn->RowCount()) {
$this->conn->MoveFirst();
while (!$this->conn->EndOfSeek()) {
$row = $this->conn->Row();
$arr[$i]['activityID'] = $row->activityID;
$arr[$i]['name'] = $row->name;
$arr[$i]['visible'] = $row->visible;
$i++;
}
return $arr;
} else {
return array();
}
}