resolves zustellnungs value bug and removes debugging prints

This commit is contained in:
SimonGschnell
2024-09-13 11:15:46 +02:00
parent 29fac520f3
commit 2b9406b172
2 changed files with 25 additions and 10 deletions
@@ -135,7 +135,7 @@ class ProfilUpdate extends FHCAPI_Controller
public function insertProfilRequest()
{
$payload = $this->input->post('payload',true);
$payload = $this->input->post('payload');
$topic = $this->input->post('topic',true);
$fileID = $this->input->post('fileID',true);
@@ -154,9 +154,6 @@ class ProfilUpdate extends FHCAPI_Controller
//? loops over all updateRequests from a user to validate if the new request is valid
$res = $this->ProfilUpdateModel->getProfilUpdatesWhere(["uid" => $this->uid]);
if (isError($res)) {
$this->terminateWithError($this->p->t('profilUpdate', 'profilUpdate_loading_error'));
}
$res = $this->getDataOrTerminateWithError($res);
//? the user cannot delete a zustelladresse/kontakt
@@ -177,13 +174,8 @@ class ProfilUpdate extends FHCAPI_Controller
$pending_changes = array_filter($res, function ($element) {
return $element->status == (self::$STATUS_PENDING ?: "Pending");
});
$test = array();
foreach ($pending_changes as $update_request) {
$existing_change = $update_request->requested_change;
$this->addMeta("paylaod",$payload);
$this->addMeta("object style", $payload[$identifier]);
$this->addMeta("array style", $payload[$identifier]);
//? the user can add as many new kontakte/adressen as he likes
if (!isset($payload["add"]) && property_exists($existing_change, $identifier) && array_key_exists($identifier,$payload) && $existing_change->$identifier == $payload[$identifier]) {
//? the kontakt_id / adresse_id of a change has to be unique
@@ -697,6 +689,30 @@ class ProfilUpdate extends FHCAPI_Controller
}
private function getOE_from_student($student_uid)
{
//? returns the oe_einheit eines Studenten
$query = "SELECT public.tbl_studiengang.oe_kurzbz
FROM public.tbl_student
JOIN public.tbl_studiengang ON tbl_student.studiengang_kz = public.tbl_studiengang.studiengang_kz
WHERE public.tbl_student.student_uid = ?;";
$res = $this->StudentModel->execReadOnlyQuery($query, [$student_uid]);
if (!isSuccess($res)) {
show_error($this->p->t('profilUpdate', 'profilUpdate_loadingOE_error'));
}
$res = hasData($res) ? getData($res) : [];
$res = array_map(
function ($item) {
return $item->oe_kurzbz;
},
$res
);
return $res;
}
}
@@ -131,7 +131,6 @@ export default {
template: /*html*/ `
<div class="gy-3 row justify-content-center align-items-center">
<!-- warning message for too many zustellungs Adressen -->
<div v-if="showZustellAdressenWarning" class="col-12 ">
<div class="card bg-danger mx-2">