also shows the zustellungs warning when there is more than one kontakt marked as zustellung

This commit is contained in:
SimonGschnell
2024-02-14 08:56:25 +01:00
parent 5ee241d914
commit bfba05753e
4 changed files with 56 additions and 3 deletions
+11
View File
@@ -23,6 +23,7 @@ class Profil extends Auth_Controller
'isMitarbeiter' => ['student/anrechnung_beantragen:r', 'user:r'],
'isStudent' => ['student/anrechnung_beantragen:r', 'user:r'],
'getZustellAdresse' => ['student/anrechnung_beantragen:r', 'user:r'],
'getZustellKontakt' => ['student/anrechnung_beantragen:r', 'user:r'],
]);
@@ -101,6 +102,16 @@ class Profil extends Auth_Controller
echo json_encode($adressen_res);
}
public function getZustellKontakt(){
$this->KontaktModel->addSelect(["kontakt_id"]);
$kontakt_res = $this->KontaktModel->loadWhere(['person_id'=>$this->pid, 'zustellung'=>true]);
$kontakt_res = hasData($kontakt_res) ? getData($kontakt_res): null;
$kontakt_res = array_map(function($item){
return $item->kontakt_id;
},$kontakt_res);
echo json_encode($kontakt_res);
}
private function viewMitarbeiterProfil($uid)
{