change all setAbbrecher to setAbbrecherNeu and rename

This commit is contained in:
cgfhtw
2024-08-06 14:49:20 +02:00
parent e6676e8868
commit 07400e7551
6 changed files with 66 additions and 126 deletions
@@ -53,7 +53,8 @@ class Leitung extends FHCAPI_Controller
// Load language phrases
$this->loadPhrases([
'studierendenantrag'
'studierendenantrag',
'lehre'
]);
}
@@ -444,7 +444,7 @@ class Status extends FHCAPI_Controller
switch($status_kurzbz){
case Prestudentstatus_model::STATUS_ABBRECHER:
$result = $this->prestudentlib->setAbbrecherNeu(
$result = $this->prestudentlib->setAbbrecher(
$prestudent_id,
$studiensemester_kurzbz,
null,
+17 -1
View File
@@ -29,6 +29,10 @@ class AntragJob extends JOB_Controller
$this->load->model('crm/Student_model', 'StudentModel');
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
$this->loadPhrases([
'lehre'
]);
}
/**
@@ -451,11 +455,23 @@ class AntragJob extends JOB_Controller
if (isError($result))
$this->logError(getError($result));
$this->load->model('crm/Statusgrund_model', 'StatusgrundModel');
$result = $this->StatusgrundModel->loadWhere(['statusgrund_kurzbz' => 'abbrecherStgl']);
if (isError($result)) {
$this->logError(getError($result));
continue;
} elseif (!hasData($result)) {
$this->logError($this->p->t('lehre', 'error_noStatusgrund', ['statusgrund_kurzbz' => 'abbrecherStgl'])); // TODO(chris): phrase
continue;
}
$statusgrund = current(getData($result));
$result = $this->prestudentlib->setAbbrecher(
$antrag->prestudent_id,
$antrag->studiensemester_kurzbz,
'AntragJob',
'abbrecherStgl',
$statusgrund->statusgrund_id,
$antrag->insertamum,
null,
$antrag->insertvon ?: $insertvon
+25 -6
View File
@@ -121,7 +121,7 @@ class AntragLib
public function unpauseAntrag($antrag_id, $insertvon)
{
if ($insertvon == Studierendenantragstatus_model::INSERTVON_DEREGISTERED)
return error($this->p->t('studierendenantrag', 'error_no_right'));
return error($this->_ci->p->t('studierendenantrag', 'error_no_right'));
if ($insertvon == Studierendenantragstatus_model::INSERTVON_ABMELDUNGSTGL) {
return $this->_ci->StudierendenantragstatusModel->resumeAntraegeForAbmeldungStgl($antrag_id);
}
@@ -257,18 +257,28 @@ class AntragLib
if (isError($result))
$errors[] = getError($result);
$this->_ci->load->model('crm/Statusgrund_model', 'StatusgrundModel');
$result = $this->_ci->StatusgrundModel->loadWhere(['statusgrund_kurzbz' => 'abbrecherStud']);
if (isError($result)) {
$errors[] = getError($result);
continue;
} elseif (!hasData($result)) {
$errors[] = $this->_ci->p->t('lehre', 'error_noStatusgrund', ['statusgrund_kurzbz' => 'abbrecherStud']);
continue;
}
$statusgrund = current(getData($result));
$result = $this->_ci->prestudentlib->setAbbrecher(
$antrag->prestudent_id,
$antrag->studiensemester_kurzbz,
$insertvon,
'abbrecherStud',
$statusgrund->statusgrund_id,
$antrag->datum,
$insertam
);
if (isError($result))
{
if (isError($result)) {
$errors[] = getError($result);
return $errors;
continue;
}
$result = $this->_ci->PersonModel->loadPrestudent($antrag->prestudent_id);
@@ -421,11 +431,20 @@ class AntragLib
// NOTE(chris): here we should have error handling but at the
// moment there is no way to notify the user for "soft" errors
$this->_ci->load->model('crm/Statusgrund_model', 'StatusgrundModel');
$result = $this->_ci->StatusgrundModel->loadWhere(['statusgrund_kurzbz' => 'abbrecherStgl']);
if (isError($result))
return $result;
if (!hasData($result))
return error($this->_ci->p->t('lehre', 'error_noStatusgrund', ['statusgrund_kurzbz' => 'abbrecherStgl']));
$statusgrund = current(getData($result));
$result = $this->_ci->prestudentlib->setAbbrecher(
$antrag->prestudent_id,
$antrag->studiensemester_kurzbz,
$insertvon,
'abbrecherStgl',
$statusgrund->statusgrund_id,
$status->insertamum
);
+1 -117
View File
@@ -35,7 +35,7 @@ class PrestudentLib
$this->_ci->load->model('organisation/Studiengang_model', 'StudiengangModel');
}
public function setAbbrecherNeu(
public function setAbbrecher(
$prestudent_id,
$studiensemester_kurzbz,
$insertvon = null,
@@ -170,122 +170,6 @@ class PrestudentLib
return success();
}
public function setAbbrecher($prestudent_id, $studiensemester_kurzbz, $insertvon = null, $statusgrund_kurzbz = null, $datum = null, $bestaetigtam = null, $bestaetigtvon = null)
{
if (!$insertvon)
$insertvon = getAuthUID();
if (!$bestaetigtvon)
$bestaetigtvon = $insertvon;
$result = $this->_ci->PrestudentstatusModel->getLastStatus($prestudent_id, $studiensemester_kurzbz);
if (isError($result))
return $result;
$result = getData($result);
if (!$result)
return error($this->_ci->p->t('studierendenantrag', 'error_no_prestudent_in_sem', [
'prestudent_id' => $prestudent_id,
'studiensemester_kurzbz' => $studiensemester_kurzbz
]));
$prestudent_status = current($result);
$result = $this->_ci->StudentModel->loadWhere(['prestudent_id' => $prestudent_id]);
if (isError($result))
return $result;
$result = getData($result);
if (!$result)
return error($this->_ci->p->t('studierendenantrag', 'error_no_student_for_prestudent', ['prestudent_id' => $prestudent_id]));
$student = current($result);
if(!$datum)
$datum = date('c');
if(!$bestaetigtam)
$bestaetigtam = date('c');
//Status und Statusgrund updaten
$result = $this->_ci->PrestudentstatusModel->withGrund($statusgrund_kurzbz)->insert([
'prestudent_id' => $prestudent_id,
'status_kurzbz' => Prestudentstatus_model::STATUS_ABBRECHER,
'studiensemester_kurzbz' => $prestudent_status->studiensemester_kurzbz,
'ausbildungssemester' => $prestudent_status->ausbildungssemester,
'datum' => $datum,
'insertvon' => $insertvon,
'insertamum' => date('c'),
'orgform_kurzbz'=> $prestudent_status->orgform_kurzbz,
'studienplan_id'=> $prestudent_status->studienplan_id,
'bestaetigtvon' => $bestaetigtvon,
'bestaetigtam' => $bestaetigtam
]);
if (isError($result))
return $result;
//refactored with processStudentlehrverband
$result = $this->_ci->StudentlehrverbandModel->processStudentlehrverband(
$student->student_uid,
$student->studiengang_kz,
0,
'A',
'',
$studiensemester_kurzbz,
Prestudentstatus_model::STATUS_ABBRECHER
);
if (isError($result))
return $result;
//noch nicht eingetragene Zeugnisnoten auf 9 setzen
$result = $this->_ci->ZeugnisnoteModel->getZeugnisnoten($student->student_uid, $prestudent_status->studiensemester_kurzbz);
if (isError($result))
return $result;
$result = getData($result) ?: [];
foreach ($result as $lv)
{
if (!$lv->note)
{
$result = $this->_ci->ZeugnisnoteModel->insert([
'note' => 9,
'studiensemester_kurzbz' => $lv->studiensemester_kurzbz,
'student_uid' => $lv->uid,
'lehrveranstaltung_id' => $lv->lehrveranstaltung_id
]);
if (isError($result)) {
$result = $this->_ci->ZeugnisnoteModel->update([
'studiensemester_kurzbz' => $lv->studiensemester_kurzbz,
'student_uid' => $lv->uid,
'lehrveranstaltung_id' => $lv->lehrveranstaltung_id
], [
'note' => 9
]);
if (isError($result))
return $result;
}
}
}
// TODO(chris): student updaten (hier oder in studentlehrverband)
// TODO(chris): db transaction
//Benutzer inaktiv setzen
$this->_ci->BenutzerModel->update([
'uid' => $student->student_uid
], [
'aktiv' => false,
'updateaktivvon' => $insertvon,
'updateaktivam' => date('c'),
'updatevon' => $insertvon,
'updateamum' => date('c')
]);
return success();
}
public function setUnterbrecher($prestudent_id, $studiensemester_kurzbz, $studierendenantrag_id = null, $insertvon = null, $ausbildungssemester = null)
{
$ausbildungssemester_plus = 0;
+20
View File
@@ -30065,6 +30065,26 @@ array(
)
)
),
array(
'app' => 'core',
'category' => 'lehre',
'phrase' => 'error_noStatusgrund',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Statusgrund {statusgrundkurzbz} nicht gefunden',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Statusgrund {statusgrundkurzbz} not found',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'lehre',