Merge branch 'master' into fronkdev

This commit is contained in:
Frank Schubert
2024-12-22 14:31:17 +01:00
29 changed files with 1265 additions and 295 deletions

View File

@@ -165,6 +165,10 @@ class TTCrud extends mfBaseController {
}
}
if (method_exists($this, 'customRowsHandler')) {
$rows = $this->customRowsHandler($rows);
}
self::returnJson(["rows" => $rows,
"autoCompleteData" => $autocompleteData,
"pagination" => ["page" => $page,
@@ -201,12 +205,12 @@ class TTCrud extends mfBaseController {
}
protected function updateAction() {
if (property_exists($this->model, 'createBy') && !isset($this->postData['createBy'])) {
$this->postData['createBy'] = $this->user->id;
}
if (property_exists($this->model, 'create') && !isset($this->postData['create'])) {
$this->postData['create'] = time();
}
// if (property_exists($this->model, 'createBy') && !isset($this->postData['createBy'])) {
// $this->postData['createBy'] = $this->user->id;
// }
// if (property_exists($this->model, 'create') && !isset($this->postData['create'])) {
// $this->postData['create'] = time();
// }
Helper::validateArray($this->postData, array_merge($this->checkArray, ['id' => ['required' => true]]));

View File

@@ -50,5 +50,42 @@ class XinonProject {
return $response;
}
/**
* Search for support tickets using a global search in Xinon OpenProject.
* @param string $search - The search query.
* @param int $pageSize - The number of results to return.
* @return array - The search results.
*/
public function searchSupportTickets(string $search, int $pageSize = 25): array {
$curl = curl_init();
$baseUrl = 'https://project.xinon.at/api/v3/projects/10/work_packages';
$queryParams = [
'pageSize' => 25,
'filters' => json_encode([['search' => ['operator' => '**', 'values' => [$search]]]])
];
curl_setopt_array($curl, array(
CURLOPT_URL => $baseUrl . '?' . http_build_query($queryParams),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array('Content-Type: application/json'),
CURLOPT_USERPWD => 'apikey:' . PROJECT_API_KEY
));
$response = curl_exec($curl);
curl_close($curl);
$json = json_decode($response, true);
return $json['_embedded']['elements'];
}
}
?>