mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
adapt functions toolbarInteressent, Phrases
This commit is contained in:
@@ -69,7 +69,7 @@ class Status extends FHCAPI_Controller
|
||||
$result = $this->StatusgrundModel->getAktiveGruende();
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
|
||||
$this->terminateWithSuccess($data);
|
||||
}
|
||||
|
||||
@@ -168,58 +168,6 @@ class Status extends FHCAPI_Controller
|
||||
$stg = $result->studiengang_kz;
|
||||
$isStudent = false;
|
||||
|
||||
if(!$this->permissionlib->isBerechtigt('admin', 'suid', $stg) && !$this->permissionlib->isBerechtigt('assistenz', 'suid', $stg))
|
||||
{
|
||||
$result = $this->p->t('lehre','error_keineSchreibrechte');
|
||||
|
||||
return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
|
||||
$_POST = json_decode(utf8_encode($this->input->raw_input_stream), true);
|
||||
|
||||
$uid = getAuthUID();
|
||||
$status_kurzbz = $this->input->post('status_kurzbz');
|
||||
$ausbildungssemester = $this->input->post('ausbildungssemester');
|
||||
$datum = $this->input->post('datum');
|
||||
$bestaetigtam = $this->input->post('bestaetigtam');
|
||||
$bewerbung_abgeschicktamum = $this->input->post('bewerbung_abgeschicktamum');
|
||||
$studienplan_id = $this->input->post('studienplan_id');
|
||||
$studiensemester_kurzbz = $this->input->post('studiensemester_kurzbz');
|
||||
$anmerkung = $this->input->post('anmerkung');
|
||||
$statusgrund_id = $this->input->post('statusgrund_id');
|
||||
$rt_stufe = $this->input->post('rt_stufe');
|
||||
$bestaetigtvon = $uid;
|
||||
|
||||
//Form Validation
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('ausbildungssemester', 'Ausbildungssemester', 'integer', [
|
||||
'integer' => $this->p->t('ui', 'error_fieldNotInteger', ['field' => 'Ausbildungssemester'])
|
||||
]);
|
||||
|
||||
$this->form_validation->set_rules('_global', '', [
|
||||
//check if Rolle already exists
|
||||
['checkIfExistingPrestudentRolle', function () use (
|
||||
$prestudent_id,
|
||||
$status_kurzbz,
|
||||
$studiensemester_kurzbz,
|
||||
$ausbildungssemester
|
||||
) {
|
||||
$result = $this->prestudentstatuschecklib->checkIfExistingPrestudentRolle(
|
||||
$prestudent_id,
|
||||
$status_kurzbz,
|
||||
$studiensemester_kurzbz,
|
||||
$ausbildungssemester
|
||||
);
|
||||
return $this->getDataOrTerminateWithError($result);
|
||||
}]
|
||||
], [
|
||||
'checkIfExistingPrestudentRolle' => $this->p->t('lehre', 'error_rolleBereitsVorhanden')
|
||||
]);
|
||||
|
||||
if (!$this->form_validation->run())
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
//GET lastStatus
|
||||
$result = $this->PrestudentstatusModel->getLastStatus($prestudent_id);
|
||||
|
||||
@@ -234,19 +182,101 @@ class Status extends FHCAPI_Controller
|
||||
else
|
||||
$lastStatusData = current(getData($result));
|
||||
|
||||
|
||||
if(!$this->permissionlib->isBerechtigt('admin', 'suid', $stg) && !$this->permissionlib->isBerechtigt('assistenz', 'suid', $stg))
|
||||
{
|
||||
$result = $this->p->t('lehre','error_keineSchreibrechte');
|
||||
|
||||
return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
|
||||
$_POST = json_decode(utf8_encode($this->input->raw_input_stream), true);
|
||||
|
||||
$uid = getAuthUID();
|
||||
$status_kurzbz = $this->input->post('status_kurzbz');
|
||||
$ausbildungssemester = $this->input->post('ausbildungssemester') ? $this->input->post('ausbildungssemester') : $lastStatusData->ausbildungssemester;
|
||||
$datum = $this->input->post('datum');
|
||||
$bestaetigtam = $this->input->post('bestaetigtam');
|
||||
$bewerbung_abgeschicktamum = $this->input->post('bewerbung_abgeschicktamum');
|
||||
$studienplan_id = $this->input->post('studienplan_id');
|
||||
$studiensemester_kurzbz = $this->input->post('studiensemester_kurzbz');
|
||||
$anmerkung = $this->input->post('anmerkung');
|
||||
$statusgrund_id = $this->input->post('statusgrund_id');
|
||||
$rt_stufe = $this->input->post('rt_stufe');
|
||||
$bestaetigtvon = $uid;
|
||||
$name = $this->input->post('name');
|
||||
|
||||
//Different handling depending on newStatus
|
||||
if($status_kurzbz == Prestudentstatus_model::STATUS_ABSOLVENT || $status_kurzbz == Prestudentstatus_model::STATUS_DIPLOMAND)
|
||||
{
|
||||
$ausbildungssemester = $lastStatusData->ausbildungssemester;
|
||||
}
|
||||
|
||||
if($status_kurzbz == Prestudentstatus_model::STATUS_BEWERBER){
|
||||
//check studiensemester_kurzbz:
|
||||
$studiensemester_kurzbz = $lastStatusData->studiensemester_kurzbz != $studiensemester_kurzbz ?
|
||||
$lastStatusData->studiensemester_kurzbz : $studiensemester_kurzbz;
|
||||
}
|
||||
//Check if Bewerberstatus exists
|
||||
if(
|
||||
$status_kurzbz == Prestudentstatus_model::STATUS_AUFGENOMMENER ||
|
||||
$status_kurzbz == Prestudentstatus_model::STATUS_WARTENDER ||
|
||||
$status_kurzbz == Prestudentstatus_model::STATUS_ABGEWIESENER
|
||||
)
|
||||
{
|
||||
$studiensemester_kurzbz = $this->getStudiensemesterOfStatus($prestudent_id, Prestudentstatus_model::STATUS_BEWERBER);
|
||||
$result = $this->prestudentstatuschecklib->checkIfExistingBewerberstatus($prestudent_id);
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
|
||||
$studiensemester_kurzbz = $this->getStudiensemesterOfStatus($prestudent_id, Prestudentstatus_model::STATUS_BEWERBER);
|
||||
}
|
||||
|
||||
//Form Validation
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$this->form_validation->set_rules('ausbildungssemester', 'Ausbildungssemester', 'integer', [
|
||||
'integer' => $this->p->t('ui', 'error_fieldNotInteger', ['field' => 'Ausbildungssemester'])
|
||||
]);
|
||||
|
||||
//TODO(Manu) how to work with name: with $this->p->t('lehre','error_rolleBereitsVorhandenMitNamen', ['name' => $studentName]));
|
||||
/* $this->form_validation->set_rules('_global', '', [
|
||||
//check if Rolle already exists
|
||||
['checkIfExistingPrestudentRolle', function () use (
|
||||
$prestudent_id,
|
||||
$status_kurzbz,
|
||||
$studiensemester_kurzbz,
|
||||
$ausbildungssemester
|
||||
) {
|
||||
$result = $this->prestudentstatuschecklib->checkIfExistingPrestudentRolle(
|
||||
$prestudent_id,
|
||||
$status_kurzbz,
|
||||
$studiensemester_kurzbz,
|
||||
$ausbildungssemester
|
||||
);
|
||||
return $this->getDataOrTerminateWithError($result);
|
||||
}]
|
||||
], [
|
||||
'checkIfExistingPrestudentRolle' => $this->p->t('lehre', 'error_rolleBereitsVorhanden')
|
||||
]);*/
|
||||
|
||||
if (!$this->form_validation->run())
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
|
||||
//check if prestudent_rolle exists
|
||||
$result = $this->PrestudentstatusModel->checkIfExistingPrestudentRolle($prestudent_id, $status_kurzbz, $studiensemester_kurzbz, $ausbildungssemester);
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
// return $this->terminateWithError($result->retval, self::ERROR_TYPE_GENERAL);
|
||||
|
||||
if($result->retval == '1')
|
||||
{
|
||||
return $this->terminateWithError($this->p->t('lehre','error_rolleBereitsVorhandenMitNamen', ['name' => $name]), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
|
||||
//Check Reihungstest
|
||||
@@ -302,16 +332,14 @@ class Status extends FHCAPI_Controller
|
||||
}
|
||||
}
|
||||
|
||||
//check if bewerberstatus exists
|
||||
//check if bewerberstatus exists TODO(Manu) necessary?
|
||||
if($status_kurzbz == Prestudentstatus_model::STATUS_AUFGENOMMENER || $status_kurzbz == Prestudentstatus_model::STATUS_WARTENDER)
|
||||
{
|
||||
|
||||
$result = $result = $this->prestudentstatuschecklib->checkIfExistingBewerberstatus($prestudent_id);
|
||||
$result = $this->prestudentstatuschecklib->checkIfExistingBewerberstatus($prestudent_id);
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//check if studentrolle already exists
|
||||
@@ -350,8 +378,6 @@ class Status extends FHCAPI_Controller
|
||||
//check if Bismeldestichtag erreicht ADDNEW status
|
||||
$result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($new_status_datum, $studiensemester_kurzbz);
|
||||
|
||||
//just testing
|
||||
//return $this->terminateWithError("here", self::ERROR_TYPE_GENERAL);
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
@@ -371,7 +397,7 @@ class Status extends FHCAPI_Controller
|
||||
}
|
||||
$result = current(getData($result));
|
||||
$statusgrund_kurzbz = $result->statusgrund_kurzbz;
|
||||
|
||||
|
||||
$this->load->library('PrestudentLib');
|
||||
$result = $this->prestudentlib->setAbbrecher($prestudent_id, $studiensemester_kurzbz, null, $statusgrund_kurzbz, $datum, $bestaetigtam, $bestaetigtvon);
|
||||
if (isError($result))
|
||||
@@ -469,7 +495,21 @@ class Status extends FHCAPI_Controller
|
||||
case Prestudentstatus_model::STATUS_ABGEWIESENER:
|
||||
{
|
||||
$this->load->library('PrestudentLib');
|
||||
$result = $this->prestudentlib->setAbgewiesener($prestudent_id, $studiensemester_kurzbz, $ausbildungssemester);
|
||||
$result = $this->prestudentlib->setAbgewiesener($prestudent_id, $studiensemester_kurzbz, $ausbildungssemester, $statusgrund_id);
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
else
|
||||
$this->terminateWithSuccess($prestudent_id);
|
||||
|
||||
}
|
||||
break;
|
||||
case Prestudentstatus_model::STATUS_WARTENDER:
|
||||
{
|
||||
$this->load->library('PrestudentLib');
|
||||
$result = $this->prestudentlib->setWartender($prestudent_id, $studiensemester_kurzbz, $ausbildungssemester);
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
@@ -686,10 +726,10 @@ class Status extends FHCAPI_Controller
|
||||
$result = $this->PrestudentstatusModel->loadWhere([
|
||||
"prestudent_id" => $prestudent_id,
|
||||
"status_kurzbz" => Prestudentstatus_model::STATUS_AUFGENOMMENER
|
||||
]);
|
||||
//$this->PrestudentstatusModel->addOrder('ausbildungssemester', 'DESC');
|
||||
$this->PrestudentstatusModel->addLimit(1);
|
||||
if (isError($result))
|
||||
]);
|
||||
//$this->PrestudentstatusModel->addOrder('ausbildungssemester', 'DESC');
|
||||
$this->PrestudentstatusModel->addLimit(1);
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
@@ -1061,9 +1101,9 @@ class Status extends FHCAPI_Controller
|
||||
return true; // Skip if access right says so
|
||||
if (!$value)
|
||||
return true; // Error will be handled by the required statement above
|
||||
|
||||
|
||||
$result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($value);
|
||||
|
||||
|
||||
return !$this->getDataOrTerminateWithError($result);
|
||||
}]
|
||||
],
|
||||
@@ -1081,7 +1121,7 @@ class Status extends FHCAPI_Controller
|
||||
['status_stud_exists', function ($value) use ($prestudent_id) {
|
||||
if ($value != Prestudentstatus_model::STATUS_STUDENT)
|
||||
return true; // Only test if new status is Student
|
||||
|
||||
|
||||
$result = $this->prestudentstatuschecklib->checkIfExistingStudentRolle($prestudent_id);
|
||||
|
||||
return $this->getDataOrTerminateWithError($result);
|
||||
@@ -1091,9 +1131,9 @@ class Status extends FHCAPI_Controller
|
||||
'status_stud_exists' => $this->p->t('lehre', 'error_noStudstatus')
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$this->form_validation->set_rules('studiensemester_kurzbz', $this->p->t('lehre', 'studiensemester'), 'required');
|
||||
|
||||
|
||||
$this->form_validation->set_rules('ausbildungssemester', $this->p->t('lehre', 'ausbildungssemester'), 'required');
|
||||
|
||||
$this->form_validation->set_rules('bestaetigtam', $this->p->t('lehre', 'bestaetigt_am'), 'is_valid_date');
|
||||
@@ -1244,7 +1284,7 @@ class Status extends FHCAPI_Controller
|
||||
'history_abbrecher' => $this->p->t('lehre', 'error_consecutiveUnterbrecherAbbrecher'),
|
||||
'history_diplomant' => $this->p->t('lehre', 'error_consecutiveDiplomandStudent')
|
||||
]);
|
||||
|
||||
|
||||
if (!$this->form_validation->run())
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
@@ -1304,10 +1344,10 @@ class Status extends FHCAPI_Controller
|
||||
|
||||
$oldstatus = current($oldstatus);
|
||||
|
||||
|
||||
|
||||
$isBerechtigtNoStudstatusCheck = $this->permissionlib->isBerechtigt('student/keine_studstatuspruefung');
|
||||
$isBerechtigtBasisPrestudentstatus = $this->permissionlib->isBerechtigt('basis/prestudentstatus');
|
||||
|
||||
|
||||
|
||||
$authUID = getAuthUID();
|
||||
$studiensemester_kurzbz = $this->input->post('studiensemester_kurzbz') ?: $oldstatus->studiensemester_kurzbz;
|
||||
@@ -1338,9 +1378,9 @@ class Status extends FHCAPI_Controller
|
||||
return true; // Skip if access right says so
|
||||
if (!$value)
|
||||
return true; // Error will be handled by the required statement above
|
||||
|
||||
|
||||
$result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($value);
|
||||
|
||||
|
||||
return !$this->getDataOrTerminateWithError($result);
|
||||
}]
|
||||
],
|
||||
@@ -1540,21 +1580,21 @@ class Status extends FHCAPI_Controller
|
||||
'updatevon' => $authUID
|
||||
];
|
||||
foreach ([
|
||||
'orgform_kurzbz',
|
||||
'anmerkung',
|
||||
'bewerbung_abgeschicktamum',
|
||||
'studienplan_id',
|
||||
'rt_stufe',
|
||||
'statusgrund_id'
|
||||
] as $key)
|
||||
'orgform_kurzbz',
|
||||
'anmerkung',
|
||||
'bewerbung_abgeschicktamum',
|
||||
'studienplan_id',
|
||||
'rt_stufe',
|
||||
'statusgrund_id'
|
||||
] as $key)
|
||||
if ($this->input->post($key))
|
||||
$updateData[$key] = $this->input->post($key);
|
||||
|
||||
|
||||
if ($this->input->post('bestaetigtam')) {
|
||||
$updateData['bestaetigtam'] = $this->input->post('bestaetigtam');
|
||||
$updateData['bestaetigtvon'] = $authUID;
|
||||
}
|
||||
|
||||
|
||||
$result = $this->PrestudentstatusModel->update([
|
||||
'prestudent_id' => $prestudent_id,
|
||||
'status_kurzbz' => $status_kurzbz,
|
||||
@@ -1609,7 +1649,7 @@ class Status extends FHCAPI_Controller
|
||||
|
||||
//Form Validation
|
||||
$this->load->library('form_validation');
|
||||
|
||||
|
||||
$this->form_validation->set_data([
|
||||
'status_kurzbz' => $status_kurzbz
|
||||
]);
|
||||
@@ -1622,7 +1662,7 @@ class Status extends FHCAPI_Controller
|
||||
['status_stud_exists', function ($value) use ($prestudent_id) {
|
||||
if ($value != Prestudentstatus_model::STATUS_STUDENT)
|
||||
return true;
|
||||
|
||||
|
||||
$result = $this->prestudentstatuschecklib->checkIfExistingStudentRolle($prestudent_id);
|
||||
|
||||
return $this->getDataOrTerminateWithError($result);
|
||||
@@ -1630,7 +1670,7 @@ class Status extends FHCAPI_Controller
|
||||
], [
|
||||
'status_stud_exists' => $this->p->t('lehre', 'error_noStudstatus')
|
||||
]);
|
||||
|
||||
|
||||
$this->form_validation->set_rules('_default', '', [
|
||||
//check if Rolle already exists
|
||||
['rolle_doesnt_exist', function () use (
|
||||
@@ -1646,7 +1686,7 @@ class Status extends FHCAPI_Controller
|
||||
], [
|
||||
'rolle_doesnt_exist' => $this->p->t('lehre', 'error_rolleBereitsVorhanden')
|
||||
]);
|
||||
|
||||
|
||||
if (!$this->form_validation->run())
|
||||
$this->terminateWithValidationErrors($this->form_validation->error_array());
|
||||
|
||||
@@ -1687,7 +1727,7 @@ class Status extends FHCAPI_Controller
|
||||
if (!$student)
|
||||
$this->terminateWithError($this->p->t('studierendenantrag', 'error_no_student_for_prestudent', ['prestudent_id' => $prestudent_id]));
|
||||
|
||||
|
||||
|
||||
//process studentlehrverband
|
||||
$this->load->model('education/Studentlehrverband_model', 'StudentlehrverbandModel');
|
||||
$result = $this->StudentlehrverbandModel->load([
|
||||
@@ -1736,7 +1776,7 @@ class Status extends FHCAPI_Controller
|
||||
$result = $this->StudentlehrverbandModel->insert($newStudentlvb);
|
||||
|
||||
$this->getDataOrTerminateWithError($result);
|
||||
|
||||
|
||||
$this->db->trans_commit();
|
||||
|
||||
return $this->outputJsonSuccess(true);
|
||||
@@ -1840,7 +1880,6 @@ class Status extends FHCAPI_Controller
|
||||
return; // No Update necessary
|
||||
|
||||
$student = current($student);
|
||||
|
||||
|
||||
$this->load->model('education/Studentlehrverband_model', 'StudentlehrverbandModel');
|
||||
$result = $this->StudentlehrverbandModel->loadWhere([
|
||||
@@ -1850,9 +1889,13 @@ class Status extends FHCAPI_Controller
|
||||
|
||||
$studentlvb = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
// NOTE(chris): if $studentlvb then update to the same values as before (except updatevon). So do nothing?
|
||||
// TODO(chris): check if that is correct (in FAS)?
|
||||
if ($studentlvb)
|
||||
return; // No Update necessary
|
||||
|
||||
$this->load->model('organisation/Lehrverband_model', 'LehrverbandModel');
|
||||
|
||||
|
||||
$this->LehrverbandModel->addLimit(1);
|
||||
$result = $this->LehrverbandModel->load([
|
||||
$student->gruppe,
|
||||
@@ -1862,33 +1905,16 @@ class Status extends FHCAPI_Controller
|
||||
]);
|
||||
$lv = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
|
||||
if ($studentlvb && !$lv)
|
||||
return; // No Update necessary
|
||||
|
||||
if ($studentlvb) // Update current Student-Lehrverband entry
|
||||
$this->StudentlehrverbandModel->update([
|
||||
'student_uid' => $student->student_uid,
|
||||
'studiensemester_kurzbz' => $studiensemester_kurzbz
|
||||
], [
|
||||
'studiengang_kz' => $student->studiengang_kz,
|
||||
'semester' => $ausbildungssemester,
|
||||
'verband' => $student->verband,
|
||||
'gruppe' => $student->gruppe,
|
||||
'updateamum' => date('c'),
|
||||
'updatevon' => $authUID
|
||||
]);
|
||||
else // Add new Student-Lehrverband entry
|
||||
$this->StudentlehrverbandModel->insert([
|
||||
'student_uid' => $student->student_uid,
|
||||
'studiensemester_kurzbz' => $studiensemester_kurzbz,
|
||||
'studiengang_kz' => $student->studiengang_kz,
|
||||
'semester' => $lv ? $ausbildungssemester : $student->semester,
|
||||
'verband' => $student->verband,
|
||||
'gruppe' => $student->gruppe,
|
||||
'insertamum' => date('c'),
|
||||
'insertvon' => $authUID
|
||||
]);
|
||||
$this->StudentlehrverbandModel->insert([
|
||||
'student_uid' => $student->student_uid,
|
||||
'studiensemester_kurzbz' => $studiensemester_kurzbz,
|
||||
'studiengang_kz' => $student->studiengang_kz,
|
||||
'semester' => $lv ? $ausbildungssemester : $student->semester,
|
||||
'verband' => $student->verband,
|
||||
'gruppe' => $student->gruppe,
|
||||
'insertamum' => date('c'),
|
||||
'insertvon' => $authUID
|
||||
]);
|
||||
}
|
||||
|
||||
private function _sanitizeAliasName($str)
|
||||
|
||||
@@ -423,8 +423,7 @@ class PrestudentLib
|
||||
|
||||
public function setStudent($prestudent_id, $studiensemester_kurzbz, $ausbildungssemester, $statusgrund_id, $bestaetigtAm, $bestaetigtVon)
|
||||
{
|
||||
$insertvon = getAuthUID();
|
||||
|
||||
|
||||
$result = $this->_ci->PrestudentstatusModel->getLastStatus($prestudent_id);
|
||||
if (isError($result))
|
||||
return $result;
|
||||
@@ -474,7 +473,7 @@ class PrestudentLib
|
||||
'statusgrund_id' => $statusgrund_id,
|
||||
'ausbildungssemester' => $ausbildungssemester,
|
||||
'datum' => date('c'),
|
||||
'insertvon' => $insertvon,
|
||||
'insertvon' => getAuthUID(),
|
||||
'insertamum' => date('c'),
|
||||
'orgform_kurzbz'=> $prestudent_status->orgform_kurzbz,
|
||||
'studienplan_id'=> $prestudent_status->studienplan_id,
|
||||
@@ -757,9 +756,9 @@ class PrestudentLib
|
||||
|
||||
$prestudent_status = current($resultLastStatus);
|
||||
|
||||
//check studiensemester_kurzbz:
|
||||
$studiensemester_kurzbz = $prestudent_status->studiensemester_kurzbz != $studiensemester_kurzbz ?
|
||||
$prestudent_status->studiensemester_kurzbz : $studiensemester_kurzbz;
|
||||
//check studiensemester_kurzbz TODO(Manu) check if Necessary: already checked in staus.php changeStatus()
|
||||
/* $studiensemester_kurzbz = $prestudent_status->studiensemester_kurzbz != $studiensemester_kurzbz ?
|
||||
$prestudent_status->studiensemester_kurzbz : $studiensemester_kurzbz;*/
|
||||
|
||||
//Status updaten
|
||||
$result = $this->_ci->PrestudentstatusModel->insert([
|
||||
@@ -817,7 +816,7 @@ class PrestudentLib
|
||||
return success();
|
||||
}
|
||||
|
||||
public function setAbgewiesener($prestudent_id, $studiensemester_kurzbz, $ausbildungssemester){
|
||||
public function setAbgewiesener($prestudent_id, $studiensemester_kurzbz, $ausbildungssemester, $statusgrund_id){
|
||||
|
||||
$resultLastStatus = $this->_ci->PrestudentstatusModel->getLastStatus($prestudent_id);
|
||||
if (isError($resultLastStatus))
|
||||
@@ -838,6 +837,39 @@ class PrestudentLib
|
||||
'orgform_kurzbz'=> $prestudent_status->orgform_kurzbz,
|
||||
'studienplan_id'=> $prestudent_status->studienplan_id,
|
||||
'bestaetigtvon' => getAuthUID(),
|
||||
'bestaetigtam' => date('c'),
|
||||
'statusgrund_id' => $statusgrund_id
|
||||
]);
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
return success();
|
||||
}
|
||||
|
||||
public function setWartender($prestudent_id, $studiensemester_kurzbz, $ausbildungssemester){
|
||||
|
||||
$resultLastStatus = $this->_ci->PrestudentstatusModel->getLastStatus($prestudent_id);
|
||||
if (isError($resultLastStatus))
|
||||
return $resultLastStatus;
|
||||
$resultLastStatus = getData($resultLastStatus);
|
||||
|
||||
$prestudent_status = current($resultLastStatus);
|
||||
|
||||
//Status updaten
|
||||
$result = $this->_ci->PrestudentstatusModel->insert([
|
||||
'prestudent_id' => $prestudent_id,
|
||||
'status_kurzbz' => Prestudentstatus_model::STATUS_WARTENDER,
|
||||
'studiensemester_kurzbz' => $studiensemester_kurzbz,
|
||||
'ausbildungssemester' => $ausbildungssemester,
|
||||
'datum' => date('c'),
|
||||
'insertvon' => getAuthUID(),
|
||||
'insertamum' => date('c'),
|
||||
'orgform_kurzbz'=> $prestudent_status->orgform_kurzbz,
|
||||
'studienplan_id'=> $prestudent_status->studienplan_id,
|
||||
'bestaetigtvon' => getAuthUID(),
|
||||
'bestaetigtam' => date('c')
|
||||
]);
|
||||
|
||||
|
||||
@@ -111,13 +111,13 @@ class PrestudentstatusCheckLib
|
||||
public function checkIfExistingPrestudentRolle(
|
||||
$prestudent_id,
|
||||
$status_kurzbz,
|
||||
$tudiensemester_kurzbz,
|
||||
$studiensemester_kurzbz,
|
||||
$ausbildungssemester
|
||||
) {
|
||||
$result = $this->_ci->PrestudentstatusModel->checkIfExistingPrestudentRolle(
|
||||
$prestudent_id,
|
||||
$status_kurzbz,
|
||||
$tudiensemester_kurzbz,
|
||||
$studiensemester_kurzbz,
|
||||
$ausbildungssemester
|
||||
);
|
||||
if (isError($result))
|
||||
|
||||
@@ -369,6 +369,16 @@ class Prestudentstatus_model extends DB_Model
|
||||
*/
|
||||
public function checkIfExistingPrestudentRolle($prestudent_id, $status_kurzbz, $studiensemester_kurzbz, $ausbildungssemester)
|
||||
{
|
||||
$studentName = '';
|
||||
|
||||
$nameRes = $this->PersonModel->loadPrestudent($prestudent_id);
|
||||
|
||||
if (hasData($nameRes))
|
||||
{
|
||||
$nameData = getData($nameRes)[0];
|
||||
$studentName = $nameData->vorname.' '.$nameData->nachname;
|
||||
}
|
||||
|
||||
$qry = "SELECT
|
||||
*
|
||||
FROM
|
||||
@@ -394,7 +404,7 @@ class Prestudentstatus_model extends DB_Model
|
||||
}
|
||||
else
|
||||
{
|
||||
return success("1", $this->p->t('lehre','error_rolleBereitsVorhanden'));
|
||||
return success("1", $this->p->t('lehre','error_rolleBereitsVorhandenMitNamen', ['name' => $studentName]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -172,35 +172,28 @@ export default {
|
||||
this.$refs.confirmStatusAction.show();
|
||||
},
|
||||
addStudent(prestudentIds){
|
||||
console.log("function addStudent ");
|
||||
//this.hideModal('confirmStatusAction');
|
||||
this.resetChangeModals();
|
||||
let changeData = {};
|
||||
|
||||
//for Feedback Sucess, Error
|
||||
let countSuccess = 0;
|
||||
let countError = 0;
|
||||
|
||||
//if(!prestudentIds)
|
||||
// prestudentIds = [this.modelValue.prestudent_id];
|
||||
|
||||
const promises = prestudentIds.map(prestudentId => {
|
||||
|
||||
changeData = this.newArray.find(item => item.prestudent_id === prestudentId);
|
||||
|
||||
//changeData = this.statusData.status_kurzbz ? this.statusData : this.newArray.find(item => item.prestudent_id === prestudentId);
|
||||
|
||||
return this.$fhcApi.post('api/frontend/v1/stv/status/addStudent/' + prestudentId,
|
||||
changeData
|
||||
).then(response => {
|
||||
countSuccess++;
|
||||
return response;
|
||||
})
|
||||
//.catch(this.$fhcAlert.handleSystemError)
|
||||
.catch(error => {
|
||||
countError++;
|
||||
//For each Prestudent show Error in Alert
|
||||
this.$fhcAlert.handleSystemError(error);
|
||||
});
|
||||
.catch(error => {
|
||||
countError++;
|
||||
//For each Prestudent show Error in Alert
|
||||
this.$fhcAlert.handleSystemError(error);
|
||||
});
|
||||
});
|
||||
|
||||
Promise
|
||||
@@ -257,7 +250,6 @@ export default {
|
||||
this.actionConfirmDialogue(this.updateData, 'studenten','Unterbrecher');
|
||||
},
|
||||
changeStatusToStudent(statusgrund_id){
|
||||
this.resetChangeModals();
|
||||
let def_date = this.getDefaultDate();
|
||||
//TODO Manu validation if Bewerber already before asking for ausbildungssemester
|
||||
//this.checkIfBewerber();
|
||||
@@ -348,13 +340,11 @@ export default {
|
||||
...deltaData,
|
||||
}));
|
||||
|
||||
this.actionConfirmDialogue(this.updateData, 'aufgenommener','Aufgenommenen');
|
||||
this.actionConfirmDialogue(this.updateData, 'aufgenommener','Aufgenommener');
|
||||
|
||||
},
|
||||
changeInteressentToStudent(statusgrund_id){
|
||||
this.resetChangeModals();
|
||||
//TODO(Manu) test statusgrund_id
|
||||
console.log("in function changeInteressentToStudent mit statusgrund_id", statusgrund_id);
|
||||
let def_date = this.getDefaultDate();
|
||||
let deltaData =
|
||||
{
|
||||
@@ -388,7 +378,7 @@ export default {
|
||||
...deltaData,
|
||||
}));
|
||||
|
||||
this.actionConfirmDialogue(this.updateData, 'abgewiesener','Abgewiesenen');
|
||||
this.actionConfirmDialogue(this.updateData, 'abgewiesener','Abgewiesener');
|
||||
},
|
||||
changeStatusToWartender(){
|
||||
this.resetChangeModals();
|
||||
@@ -404,12 +394,10 @@ export default {
|
||||
...deltaData,
|
||||
}));
|
||||
|
||||
this.actionConfirmDialogue(this.updateData, 'wartender','Wartenden');
|
||||
this.actionConfirmDialogue(this.updateData, 'wartender','Wartender');
|
||||
},
|
||||
changeStatus(prestudentIds){
|
||||
console.log("function changeStatus ");
|
||||
this.resetChangeModals();
|
||||
//Array.isArray(prestudentIds) ? this.modelValue.prestudent_id : [prestudentIds];
|
||||
let changeData = {};
|
||||
|
||||
//for Feedback Sucess, Error
|
||||
@@ -426,8 +414,6 @@ export default {
|
||||
this.newArray.push({ ausbildungssemester: this.actionSem });
|
||||
}
|
||||
|
||||
console.log("ausbildungssem: " + this.actionSem);
|
||||
|
||||
const promises = prestudentIds.map(prestudentId => {
|
||||
|
||||
changeData = this.newArray.find(item => item.prestudent_id === prestudentId);
|
||||
@@ -461,7 +447,7 @@ export default {
|
||||
// }
|
||||
|
||||
//Feedback Success als infoalert
|
||||
if (countSuccess > 0) {
|
||||
if (countSuccess > 0 || countError > 0 ) {
|
||||
this.$fhcAlert.alertInfo(this.$p.t('ui', 'successNewStatus', {
|
||||
'countSuccess': countSuccess,
|
||||
'status': this.newStatus,
|
||||
@@ -469,9 +455,7 @@ export default {
|
||||
}));
|
||||
}
|
||||
|
||||
//TODO(Manu) bei status Interessent, Bewerber, aufgenommener, reload nicht working
|
||||
|
||||
if(this.prestudentIds.length == 1){
|
||||
if(this.prestudentIds.length == 1 && countSuccess > 0){
|
||||
this.reload();
|
||||
|
||||
//necessary to see new status in List
|
||||
@@ -496,58 +480,6 @@ export default {
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
},
|
||||
/*checkIfBewerber(prestudentIds){
|
||||
|
||||
if(!prestudentIds)
|
||||
prestudentIds = [this.modelValue.prestudent_id];
|
||||
|
||||
const promises = prestudentIds.map(prestudentId => {
|
||||
|
||||
return this.$fhcApi.post('api/frontend/v1/stv/status/hasStatusBewerber/' + prestudentId,
|
||||
).then(response => {
|
||||
countSuccess++;
|
||||
return response;
|
||||
})
|
||||
//.catch(this.$fhcAlert.handleSystemError)
|
||||
.catch(error => {
|
||||
countError++;
|
||||
//For each Prestudent show Error in Alert
|
||||
this.$fhcAlert.handleSystemError(error);
|
||||
});
|
||||
});
|
||||
|
||||
Promise
|
||||
.allSettled(promises)
|
||||
.then(values => {
|
||||
|
||||
//Feedback Success als infoalert
|
||||
if (countSuccess > 0) {
|
||||
this.$fhcAlert.alertInfo(this.$p.t('ui', 'successNewStatus', {
|
||||
'countSuccess': countSuccess,
|
||||
'status': this.newStatus,
|
||||
'countError': countError
|
||||
}));
|
||||
}
|
||||
|
||||
if (this.modelValue.prestudent_id) {
|
||||
this.reload();
|
||||
//TODO(manu) reload Detailtab after Abbrecher to see current status activ, verband and gruppe
|
||||
}
|
||||
else {
|
||||
this.$reloadList();
|
||||
}
|
||||
|
||||
/!*return this.$fhcApi
|
||||
.get('api/frontend/v1/stv/status/hasStatusBewerber/' + prestudent_id)
|
||||
.then(
|
||||
result => {
|
||||
this.isBewerber = result.data;
|
||||
console.log(result);
|
||||
return result;
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);*!/
|
||||
//}
|
||||
},*/
|
||||
getDefaultDate() {
|
||||
const today = new Date();
|
||||
return today;
|
||||
|
||||
@@ -27997,6 +27997,26 @@ array(
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'lehre',
|
||||
'phrase' => 'error_rolleBereitsVorhandenMitNamen',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => '{name}: Diese Rolle ist bereits vorhanden!',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => '{name}: This role already exists!',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'lehre',
|
||||
|
||||
Reference in New Issue
Block a user