Merge branch 'master' into bug-66890/studierendenverwaltung_statuswechsel_doppelte_statuseintraege

This commit is contained in:
Harald Bamberger
2025-10-01 13:24:45 +02:00
18 changed files with 260 additions and 110 deletions
@@ -60,17 +60,6 @@ class Favorites extends FHCAPI_Controller
$favorites = $this->input->post('favorites');
$removed = [];
while (strlen($favorites) > 64) {
$favObj = json_decode($favorites);
if (!$favObj->list)
break;
$removed[] = array_shift($favObj->list);
$favorites = json_encode($favObj);
}
if ($removed)
$this->addMeta('removed', $removed);
$result = $this->VariableModel->setVariable(getAuthUID(), 'stv_favorites', $favorites);
$this->getDataOrTerminateWithError($result);
@@ -434,7 +434,10 @@ class Kontakt extends FHCAPI_Controller
$this->FirmaModel->addJoin('public.tbl_firma f', 'ON (f.firma_id = st.firma_id)', 'LEFT');
$this->KontakttypModel->addJoin('public.tbl_kontakttyp kt', 'ON (public.tbl_kontakt.kontakttyp = kt.kontakttyp)');
$result = $this->KontaktModel->loadWhere(
array('person_id' => $person_id)
array(
'person_id' => $person_id,
'public.tbl_kontakt.kontakttyp !=' => 'hidden'
)
);
if (isError($result))
@@ -442,20 +445,18 @@ class Kontakt extends FHCAPI_Controller
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
$this->terminateWithSuccess((getData($result) ?: []));
}
public function getKontakttypen()
{
$this->load->model('person/Kontakttyp_model', 'KontakttypModel');
$this->KontakttypModel->addOrder('beschreibung', 'ASC');
$result = $this->KontakttypModel->loadWhere(array('kontakttyp !=' => 'hidden'));
$result = $this->KontakttypModel->load();
if (isError($result)) {
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
else
{
$this->terminateWithSuccess(getData($result) ?: []);
}
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
public function loadContact()
@@ -138,13 +138,24 @@ class Prestudent extends FHCAPI_Controller
{
$val = $this->input->post($prop, true);
if ($val !== null || $prop === 'foerderrelevant') {
if ($val !== null) {
if(in_array($prop, ['dual', 'bismelden', 'foerderrelevant']))
{
$val = boolval($val);
}
elseif (
$val === ''
&& in_array($prop, ['zgvnation', 'zgvmanation', 'zgvdoktornation', 'berufstaetigkeit_code', 'ausbildungcode'])
)
{
$val = null;
}
$update_prestudent[$prop] = $val;
}
// allowed to be null, but has to be in postparameter
if (
in_array($prop, ['zgvdatum', 'zgvmadatum', 'zgvdoktordatum', 'zgv_code', 'zgvmas_code', 'zgvdoktor_code'])
in_array($prop, ['foerderrelevant', 'zgvdatum', 'zgvmadatum', 'zgvdoktordatum', 'zgv_code', 'zgvmas_code', 'zgvdoktor_code'])
&& !isset($update_prestudent[$prop])
&& array_key_exists($prop, $_POST)
)
@@ -286,11 +286,11 @@ class Status extends FHCAPI_Controller
]);
$this->form_validation->set_rules('_default', '', [
['meldestichtag_not_exceeded', function () use ($datum, $isBerechtigtNoStudstatusCheck) {
['meldestichtag_not_exceeded', function () use ($datum_string, $isBerechtigtNoStudstatusCheck) {
if ($isBerechtigtNoStudstatusCheck)
return true; // Skip if access right says so
$result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($datum);
$result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($datum_string);
return !$this->getDataOrTerminateWithError($result);
}],
@@ -733,8 +733,9 @@ class Status extends FHCAPI_Controller
);
$result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($oldstatus->datum);
$isMeldestichtagErreicht = $this->getDataOrTerminateWithError($result);
if (!$this->getDataOrTerminateWithError($result))
if ($isMeldestichtagErreicht)
$this->terminateWithError(
$this->p->t('lehre', 'error_dataVorMeldestichtag'),
self::ERROR_TYPE_GENERAL,
@@ -276,7 +276,17 @@ class Student extends FHCAPI_Controller
$update_person = array();
foreach ($array_allowed_props_person as $prop) {
$val = $this->input->post($prop);
if ($val !== null) {
if ($val === null)
{
continue;
}
if($prop == 'foto')
{
$fotoval = ($val == '') ? null : str_replace('data:image/jpeg;base64,', '', $val);
$update_person[$prop] = $fotoval;
}
else
{
$update_person[$prop] = $val;
}
}
+8 -2
View File
@@ -214,7 +214,7 @@ class ProfilLib{
* @param integer $uid the userID used to get the kontakt information
* @return array all the kontakt information corresponding to a userID
*/
private function getKontaktInfo($pid)
private function getKontaktInfo($pid, $includehidden=false)
{
$this->ci->load->model("person/Kontakt_model","KontaktModel");
$this->ci->KontaktModel->addSelect(['kontakttyp', 'kontakt_id', 'kontakt', 'tbl_kontakt.anmerkung', 'tbl_kontakt.zustellung']);
@@ -222,7 +222,13 @@ class ProfilLib{
$this->ci->KontaktModel->addJoin('public.tbl_firma', 'firma_id', 'LEFT');
$this->ci->KontaktModel->addOrder('kontakttyp, kontakt, tbl_kontakt.updateamum, tbl_kontakt.insertamum');
$kontakte_res = $this->ci->KontaktModel->loadWhere(['person_id' => $pid]);
$params = array('person_id' => $pid);
if(!$includehidden)
{
$params['kontakttyp <>'] = 'hidden';
}
$kontakte_res = $this->ci->KontaktModel->loadWhere($params);
if(isError($kontakte_res)){
return error(getData($kontakte_res));
}