mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-19 16:02:15 +00:00
Check History for Student status
This commit is contained in:
@@ -262,9 +262,6 @@ class Status extends FHCAPI_Controller
|
||||
|
||||
return $this->getDataOrTerminateWithError($result);
|
||||
}]
|
||||
// TODO(chris): check status history error_wrongStatusOrderBeforeStudent
|
||||
// TODO(chris): check status history error_personenkennzeichenPasstNichtZuStudiensemester
|
||||
// TODO(chris): check status history error_bewerberOrgformUngleichStudentOrgform
|
||||
], [
|
||||
'rolle_doesnt_exist' => $this->p->t('lehre', 'error_rolleBereitsVorhanden'),
|
||||
'history_timesequence' => $this->p->t('lehre', 'error_statuseintrag_zeitabfolge'),
|
||||
|
||||
@@ -335,7 +335,8 @@ class PrestudentstatusCheckLib
|
||||
'laststatus' => true,
|
||||
'unterbrechersemester' => true,
|
||||
'abbrechersemester' => true,
|
||||
'diplomant' => true
|
||||
'diplomant' => true,
|
||||
'student' => true
|
||||
];
|
||||
|
||||
for ($n = 0, $c = 1; $c < $historyCount; $n++, $c++) {
|
||||
@@ -344,6 +345,7 @@ class PrestudentstatusCheckLib
|
||||
&& !$checks['unterbrechersemester']
|
||||
&& !$checks['abbrechersemester']
|
||||
&& !$checks['diplomant']
|
||||
&& !$checks['student']
|
||||
)
|
||||
break; // early out
|
||||
|
||||
@@ -358,32 +360,44 @@ class PrestudentstatusCheckLib
|
||||
|
||||
// Abbrecher- oder Absolventenstatus muss Endstatus sein
|
||||
if ($checks['laststatus']
|
||||
&& in_array($current->status_kurzbz, ['Absolvent', 'Abbrecher'])
|
||||
&& in_array($current->status_kurzbz, [self::ABSOLVENT_STATUS, self::ABBRECHER_STATUS])
|
||||
)
|
||||
$checks['laststatus'] = false;
|
||||
|
||||
// wenn Unterbrecher auf Unterbrecher folgt, muss Ausbildungssemester gleich sein
|
||||
if ($checks['unterbrechersemester']
|
||||
&& $current->status_kurzbz == 'Unterbrecher'
|
||||
&& $next->status_kurzbz == 'Unterbrecher'
|
||||
&& $current->status_kurzbz == self::UNTERBRECHER_STATUS
|
||||
&& $next->status_kurzbz == self::UNTERBRECHER_STATUS
|
||||
&& $current->ausbildungssemester != $next->ausbildungssemester
|
||||
)
|
||||
$checks['unterbrechersemester'] = false;
|
||||
|
||||
// wenn Abbrecher auf Unterbrecher folgt, muss Ausbildungssemester gleich sein
|
||||
if ($checks['abbrechersemester']
|
||||
&& $current->status_kurzbz == 'Unterbrecher'
|
||||
&& $next->status_kurzbz == 'Abbrecher'
|
||||
&& $current->status_kurzbz == self::UNTERBRECHER_STATUS
|
||||
&& $next->status_kurzbz == self::ABBRECHER_STATUS
|
||||
&& $current->ausbildungssemester != $next->ausbildungssemester
|
||||
)
|
||||
$checks['abbrechersemester'] = false;
|
||||
|
||||
// keine Studenten nach Diplomand Status
|
||||
if ($checks['diplomant']
|
||||
&& $current->status_kurzbz == 'Diplomand'
|
||||
&& $next->status_kurzbz == 'Student'
|
||||
)
|
||||
$checks['diplomant'] = false;
|
||||
if (($checks['diplomant']
|
||||
|| $checks['student'])
|
||||
&& $next->status_kurzbz == self::STUDENT_STATUS
|
||||
) {
|
||||
$restl_stati = array_unique(array_column(array_slice($history, $c), 'status_kurzbz'));
|
||||
|
||||
// keine Studenten nach Diplomand Status
|
||||
if ($checks['diplomant']
|
||||
&& in_array(self::DIPLOMAND_STATUS, $restl_stati)
|
||||
)
|
||||
$checks['diplomant'] = false;
|
||||
|
||||
// vor Studentenstatus müssen bestimmte Status vorhanden sein
|
||||
if ($checks['student']
|
||||
&& array_values(array_intersect($restl_stati, $this->_statusAbfolgeVorStudent)) != array_values($this->_statusAbfolgeVorStudent)
|
||||
)
|
||||
$checks['student'] = false;
|
||||
}
|
||||
}
|
||||
|
||||
$this->_cache_history[$primary] = success($checks);
|
||||
@@ -584,6 +598,44 @@ class PrestudentstatusCheckLib
|
||||
return success(getData($result)['diplomant']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a Student precedes given stati in the status history.
|
||||
*
|
||||
* @param integer $prestudent_id
|
||||
* @param string $status_kurzbz
|
||||
* @param DateTime $new_date
|
||||
* @param string $new_studiensemester_kurzbz
|
||||
* @param integer $new_ausbildungssemester
|
||||
* @param string $old_studiensemester_kurzbz
|
||||
* @param integer $old_ausbildungssemester
|
||||
*
|
||||
* @return stdClass
|
||||
*/
|
||||
public function checkStatusHistoryStudent(
|
||||
$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;
|
||||
|
||||
return success(getData($result)['student']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if Personenkennzeichen is set correctly.
|
||||
*
|
||||
@@ -605,6 +657,7 @@ class PrestudentstatusCheckLib
|
||||
$this->_ci->PrestudentstatusModel->addLimit(1);
|
||||
|
||||
$result = $this->_ci->PrestudentstatusModel->loadWhere([
|
||||
'tbl_prestudentstatus.prestudent_id' => $prestudent_id,
|
||||
'tbl_prestudentstatus.status_kurzbz' => self::STATUS_STUDENT
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user