mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-29 18:09:28 +00:00
prestudentstatus check: added personenkennzeichen semester check
This commit is contained in:
@@ -425,6 +425,29 @@ class Status extends FHCAPI_Controller
|
||||
''
|
||||
);
|
||||
|
||||
return $this->getDataOrTerminateWithError($result);
|
||||
}],
|
||||
['wrong_personenkennzeichen', function () use (
|
||||
$isBerechtigtNoStudstatusCheck,
|
||||
$prestudent_id,
|
||||
$status_kurzbz,
|
||||
$datum,
|
||||
$studiensemester_kurzbz,
|
||||
$ausbildungssemester
|
||||
) {
|
||||
if ($isBerechtigtNoStudstatusCheck)
|
||||
return true; // Skip if access right says so
|
||||
|
||||
$result = $this->prestudentstatuschecklib->checkPersonenkennzeichen(
|
||||
$prestudent_id,
|
||||
$status_kurzbz,
|
||||
$datum,
|
||||
$studiensemester_kurzbz,
|
||||
$ausbildungssemester,
|
||||
'',
|
||||
''
|
||||
);
|
||||
|
||||
return $this->getDataOrTerminateWithError($result);
|
||||
}]
|
||||
], [
|
||||
@@ -434,7 +457,8 @@ class Status extends FHCAPI_Controller
|
||||
'history_laststatus' => $this->p->t('lehre', 'error_endstatus'),
|
||||
'history_unterbrecher' => $this->p->t('lehre', 'error_consecutiveUnterbrecher'),
|
||||
'history_abbrecher' => $this->p->t('lehre', 'error_consecutiveUnterbrecherAbbrecher'),
|
||||
'history_diplomant' => $this->p->t('lehre', 'error_consecutiveDiplomandStudent')
|
||||
'history_diplomant' => $this->p->t('lehre', 'error_consecutiveDiplomandStudent'),
|
||||
'wrong_personenkennzeichen' => $this->p->t('lehre', 'error_personenkennzeichenPasstNichtZuStudiensemester')
|
||||
]);
|
||||
|
||||
if (!$this->form_validation->run())
|
||||
@@ -1031,15 +1055,40 @@ class Status extends FHCAPI_Controller
|
||||
''
|
||||
);
|
||||
|
||||
return $this->getDataOrTerminateWithError($result);
|
||||
}],
|
||||
['wrong_personenkennzeichen', function () use (
|
||||
$isBerechtigtNoStudstatusCheck,
|
||||
$prestudent_id,
|
||||
$status_kurzbz,
|
||||
$datum,
|
||||
$studiensemester_kurzbz,
|
||||
$ausbildungssemester
|
||||
) {
|
||||
if ($isBerechtigtNoStudstatusCheck)
|
||||
return true; // Skip if access right says so
|
||||
|
||||
$result = $this->prestudentstatuschecklib->checkPersonenkennzeichen(
|
||||
$prestudent_id,
|
||||
$status_kurzbz,
|
||||
new DateTime($datum),
|
||||
$studiensemester_kurzbz,
|
||||
$ausbildungssemester,
|
||||
'',
|
||||
''
|
||||
);
|
||||
|
||||
return $this->getDataOrTerminateWithError($result);
|
||||
}]
|
||||
|
||||
], [
|
||||
'rolle_doesnt_exist' => $this->p->t('lehre', 'error_rolleBereitsVorhanden'),
|
||||
'history_timesequence' => $this->p->t('lehre', 'error_statuseintrag_zeitabfolge'),
|
||||
'history_laststatus' => $this->p->t('lehre', 'error_endstatus'),
|
||||
'history_unterbrecher' => $this->p->t('lehre', 'error_consecutiveUnterbrecher'),
|
||||
'history_abbrecher' => $this->p->t('lehre', 'error_consecutiveUnterbrecherAbbrecher'),
|
||||
'history_diplomant' => $this->p->t('lehre', 'error_consecutiveDiplomandStudent')
|
||||
'history_diplomant' => $this->p->t('lehre', 'error_consecutiveDiplomandStudent'),
|
||||
'wrong_personenkennzeichen' => $this->p->t('lehre', 'error_personenkennzeichenPasstNichtZuStudiensemester')
|
||||
]);
|
||||
|
||||
if (!$this->form_validation->run())
|
||||
@@ -1339,6 +1388,31 @@ class Status extends FHCAPI_Controller
|
||||
$key_ausbildungssemester
|
||||
);
|
||||
|
||||
return $this->getDataOrTerminateWithError($result);
|
||||
}],
|
||||
['wrong_personenkennzeichen', function () use (
|
||||
$isBerechtigtNoStudstatusCheck,
|
||||
$prestudent_id,
|
||||
$status_kurzbz,
|
||||
$datum,
|
||||
$studiensemester_kurzbz,
|
||||
$ausbildungssemester,
|
||||
$key_studiensemester_kurzbz,
|
||||
$key_ausbildungssemester
|
||||
) {
|
||||
if ($isBerechtigtNoStudstatusCheck)
|
||||
return true; // Skip if access right says so
|
||||
|
||||
$result = $this->prestudentstatuschecklib->checkPersonenkennzeichen(
|
||||
$prestudent_id,
|
||||
$status_kurzbz,
|
||||
new DateTime($datum),
|
||||
$studiensemester_kurzbz,
|
||||
$ausbildungssemester,
|
||||
$key_studiensemester_kurzbz,
|
||||
$key_ausbildungssemester
|
||||
);
|
||||
|
||||
return $this->getDataOrTerminateWithError($result);
|
||||
}]
|
||||
], [
|
||||
@@ -1347,7 +1421,8 @@ class Status extends FHCAPI_Controller
|
||||
'history_laststatus' => $this->p->t('lehre', 'error_endstatus'),
|
||||
'history_unterbrecher' => $this->p->t('lehre', 'error_consecutiveUnterbrecher'),
|
||||
'history_abbrecher' => $this->p->t('lehre', 'error_consecutiveUnterbrecherAbbrecher'),
|
||||
'history_diplomant' => $this->p->t('lehre', 'error_consecutiveDiplomandStudent')
|
||||
'history_diplomant' => $this->p->t('lehre', 'error_consecutiveDiplomandStudent'),
|
||||
'wrong_personenkennzeichen' => $this->p->t('lehre', 'error_personenkennzeichenPasstNichtZuStudiensemester')
|
||||
]);
|
||||
|
||||
if (!$this->form_validation->run())
|
||||
|
||||
@@ -334,7 +334,8 @@ class PrestudentstatusCheckLib
|
||||
'unterbrechersemester' => true,
|
||||
'abbrechersemester' => true,
|
||||
'diplomant' => true,
|
||||
'student' => true
|
||||
'student' => true,
|
||||
'studentPerskz' => true
|
||||
];
|
||||
|
||||
for ($n = 0, $c = 1; $c < $historyCount; $n++, $c++) {
|
||||
@@ -344,6 +345,7 @@ class PrestudentstatusCheckLib
|
||||
&& !$checks['abbrechersemester']
|
||||
&& !$checks['diplomant']
|
||||
&& !$checks['student']
|
||||
&& !$checks['studentPerskz']
|
||||
)
|
||||
break; // early out
|
||||
|
||||
@@ -379,7 +381,8 @@ class PrestudentstatusCheckLib
|
||||
$checks['abbrechersemester'] = false;
|
||||
|
||||
if (($checks['diplomant']
|
||||
|| $checks['student'])
|
||||
|| $checks['student']
|
||||
|| $checks['studentPerskz'])
|
||||
&& $next->status_kurzbz == self::STUDENT_STATUS
|
||||
) {
|
||||
$restl_stati = array_unique(array_column(array_slice($history, $c), 'status_kurzbz'));
|
||||
@@ -395,6 +398,24 @@ class PrestudentstatusCheckLib
|
||||
&& array_values(array_intersect($restl_stati, $this->_statusAbfolgeVorStudent)) != array_values($this->_statusAbfolgeVorStudent)
|
||||
)
|
||||
$checks['student'] = false;
|
||||
|
||||
// korrektes Personenkennzeichen zu erstem Student status
|
||||
if ($checks['studentPerskz'] && !in_array(self::STUDENT_STATUS, $restl_stati))
|
||||
{
|
||||
$this->_ci->StudentModel->addLimit('1');
|
||||
$result = $this->_ci->StudentModel->loadWhere(['prestudent_id' => $prestudent_id]);
|
||||
|
||||
if (isError($result))
|
||||
return $result;
|
||||
|
||||
if (!hasData($result))
|
||||
return error('Prestudent without student entry');
|
||||
|
||||
$personenkennzeichen = getData($result)[0]->matrikelnr;
|
||||
|
||||
$jahr = $this->_ci->StudiensemesterModel->getStudienjahrNumberFromStudiensemester($next->studiensemester_kurzbz);
|
||||
$checks['studentPerskz'] = $jahr == mb_substr($personenkennzeichen, 0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -642,37 +663,29 @@ class PrestudentstatusCheckLib
|
||||
*
|
||||
* @return stdClass
|
||||
*/
|
||||
public function checkPersonenkennzeichen($prestudent_id)
|
||||
{
|
||||
// TODO(chris): TEST
|
||||
$this->_ci->PrestudentstatusModel->addSelect('tbl_prestudentstatus.prestudent_id');
|
||||
$this->_ci->PrestudentstatusModel->addSelect('tbl_student.matrikelnr');
|
||||
|
||||
$this->_ci->PrestudentstatusModel->addJoin('public.tbl_student', 'prestudent_id');
|
||||
|
||||
$this->_ci->PrestudentstatusModel->addOrder('tbl_prestudentstatus.datum', 'DESC');
|
||||
$this->_ci->PrestudentstatusModel->addOrder('tbl_prestudentstatus.insertamum', 'DESC');
|
||||
$this->_ci->PrestudentstatusModel->addOrder('tbl_prestudentstatus.ext_id', 'DESC');
|
||||
|
||||
$this->_ci->PrestudentstatusModel->addLimit(1);
|
||||
|
||||
$result = $this->_ci->PrestudentstatusModel->loadWhere([
|
||||
'tbl_prestudentstatus.prestudent_id' => $prestudent_id,
|
||||
'tbl_prestudentstatus.status_kurzbz' => self::STATUS_STUDENT
|
||||
]);
|
||||
public function checkPersonenkennzeichen(
|
||||
$prestudent_id,
|
||||
$status_kurzbz,
|
||||
$new_date,
|
||||
$new_studiensemester_kurzbz,
|
||||
$new_ausbildungssemester,
|
||||
$old_studiensemester_kurzbz,
|
||||
$old_ausbildungssemester
|
||||
) {
|
||||
$result = $this->prepareStatusHistory(
|
||||
$prestudent_id,
|
||||
$status_kurzbz,
|
||||
$new_date,
|
||||
$new_studiensemester_kurzbz,
|
||||
$new_ausbildungssemester,
|
||||
$old_studiensemester_kurzbz,
|
||||
$old_ausbildungssemester
|
||||
);
|
||||
|
||||
if (isError($result))
|
||||
return $result;
|
||||
|
||||
if (!hasData($result))
|
||||
return success(true); // Not a student yet so no wrong personenkennzeichen
|
||||
|
||||
$data = current(getData($result));
|
||||
|
||||
$jahr = $this->_ci->StudiensemesterModel->getStudienjahrNumberFromStudiensemester($data->studiensemester_kurzbz);
|
||||
|
||||
|
||||
return success($jahr == mb_substr($data->matrikelnr, 0, 2));
|
||||
return success(getData($result)['studentPerskz']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user