2023-08-17 19:08:24 +02:00
|
|
|
<?php
|
2023-08-21 20:37:59 +02:00
|
|
|
include 'zefixAPI.php';
|
2023-08-21 17:08:15 +02:00
|
|
|
|
2023-08-17 21:38:35 +02:00
|
|
|
|
2023-09-25 11:55:08 +02:00
|
|
|
|
2023-08-21 20:37:59 +02:00
|
|
|
/*
|
|
|
|
* Request Types:
|
|
|
|
* Count
|
|
|
|
* List
|
|
|
|
* Export
|
|
|
|
*/
|
2023-08-17 21:38:35 +02:00
|
|
|
// Request data
|
2023-08-21 20:37:59 +02:00
|
|
|
$data = array();
|
|
|
|
|
|
|
|
$results = array();
|
|
|
|
|
|
|
|
// Wenn Firmenname vorhanden
|
|
|
|
if(isset($_POST['firma']) && !empty($_POST['firma'])) {
|
|
|
|
$data["name"] = $_POST['firma'];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Wenn gelöschte auch gesucht werden sollen
|
|
|
|
if(isset($_POST['geloeschteRechtseinheiten'])) {
|
|
|
|
$data["activeOnly"] = false;
|
|
|
|
} else {
|
|
|
|
$data["activeOnly"] = true;
|
2023-08-17 21:38:35 +02:00
|
|
|
}
|
|
|
|
|
2023-08-21 20:37:59 +02:00
|
|
|
$rechtsformen = array();
|
|
|
|
if (isset($_POST['rechtsform']) && is_array($_POST['rechtsform']) && count($_POST['rechtsform']) > 0) {
|
|
|
|
$rechtsformen = $_POST['rechtsform'];
|
|
|
|
} else {
|
2023-09-25 11:13:53 +02:00
|
|
|
$legalFormArray = json_decode(sendAPILegalFormRequest($username, $password), true);
|
|
|
|
foreach ($legalFormArray as $rechtsform) {
|
|
|
|
$rechtsformen[] = $rechtsform["id"];
|
|
|
|
}
|
2023-08-21 20:37:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$sitze = array();
|
|
|
|
if (isset($_POST['sitze']) && is_array($_POST['sitze']) && count($_POST['sitze']) > 0) {
|
|
|
|
$sitze = $_POST['sitze'];
|
|
|
|
} else {
|
2023-09-25 11:13:53 +02:00
|
|
|
$communityArray = json_decode(sendAPICommunityRequest($username, $password), true);
|
|
|
|
foreach ($communityArray as $community) {
|
|
|
|
$sitze[] = $community["bfsId"];
|
|
|
|
}
|
2023-08-21 20:37:59 +02:00
|
|
|
}
|
|
|
|
// Loop through the selected values
|
2023-09-25 11:55:08 +02:00
|
|
|
$taskString = '';
|
2023-08-21 20:37:59 +02:00
|
|
|
foreach ($rechtsformen as $rechtsform) {
|
|
|
|
$data["legalFormId"] = $rechtsform;
|
2023-08-17 21:38:35 +02:00
|
|
|
|
2023-08-21 20:37:59 +02:00
|
|
|
// Loop through the selected values
|
|
|
|
foreach ($sitze as $sitz) {
|
|
|
|
$data["legalSeatId"] = $sitz;
|
2023-09-25 11:55:08 +02:00
|
|
|
//$response = sendAPICompanySearchRequest($username, $password, $data);
|
|
|
|
$taskString = $taskString.json_encode($data).'\n';
|
2023-08-21 20:37:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2023-08-17 21:38:35 +02:00
|
|
|
|
2023-09-25 11:55:08 +02:00
|
|
|
|
|
|
|
$taskfilename = '/tasks/'.time().bin2hex(random_bytes(4)).'txt';
|
|
|
|
$taskfile = fopen($taskfilename, 'w');
|
|
|
|
if($taskfile){
|
|
|
|
echo "writing to file";
|
|
|
|
fwrite($taskfile, $taskString);
|
|
|
|
fclose($taskfile);
|
|
|
|
} else {
|
|
|
|
echo "not writing to file";
|
|
|
|
}
|
|
|
|
|
|
|
|
//$constructed_response = $response;
|
2023-08-17 21:38:35 +02:00
|
|
|
|
|
|
|
// Send the response back to the client
|
2023-08-21 20:37:59 +02:00
|
|
|
//header('Content-Type: application/json');
|
|
|
|
//echo $constructed_response;
|
|
|
|
|
2023-08-21 21:16:49 +02:00
|
|
|
|
2023-08-17 19:08:24 +02:00
|
|
|
?>
|