mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
check Bismeldestichtag, refactor Lehrverband
This commit is contained in:
@@ -44,17 +44,24 @@ class Status extends FHC_Controller
|
||||
$this->outputJson($result);
|
||||
}
|
||||
|
||||
public function getLastBismeldestichtag()
|
||||
{
|
||||
$this->load->model('codex/Bismeldestichtag_model', 'BismeldestichtagModel');
|
||||
|
||||
$result = $this->BismeldestichtagModel->getLastReachedMeldestichtag();
|
||||
if (isError($result)) {
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
$this->outputJson($result);
|
||||
}
|
||||
|
||||
public function addNewStatus($prestudent_id)
|
||||
{
|
||||
/* $this->load->library('form_validation');
|
||||
$granted_Ass = $this->permissionlib->getSTG_isEntitledFor('assistenz') ? $this->permissionlib->getSTG_isEntitledFor('assistenz') : [];
|
||||
$granted_Adm = $this->permissionlib->getSTG_isEntitledFor('admin') ? $this->permissionlib->getSTG_isEntitledFor('admin') : [];
|
||||
$granted = array_merge($granted_Ass, $granted_Adm);
|
||||
|
||||
|
||||
if ($this->form_validation->run() == false)
|
||||
{
|
||||
return $this->outputJsonError($this->form_validation->error_array());
|
||||
}*/
|
||||
|
||||
//check rights
|
||||
//get Studiengang von prestudent_id
|
||||
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
$this->PrestudentModel->addJoin('public.tbl_person p', 'ON (p.person_id = public.tbl_prestudent.person_id)');
|
||||
$result = $this->PrestudentModel->load([
|
||||
@@ -73,11 +80,6 @@ class Status extends FHC_Controller
|
||||
$name = trim($result->vorname . " ". $result->nachname);
|
||||
$zgv_code = $result->zgv_code;
|
||||
|
||||
//TODO(Manu) check: Annahme, dass hier immer suid bei Berechtigung STG vergeben wird!
|
||||
$granted_Ass = $this->permissionlib->getSTG_isEntitledFor('assistenz') ? $this->permissionlib->getSTG_isEntitledFor('assistenz') : [];
|
||||
$granted_Adm = $this->permissionlib->getSTG_isEntitledFor('admin') ? $this->permissionlib->getSTG_isEntitledFor('admin') : [];
|
||||
$granted = array_merge($granted_Ass, $granted_Adm);
|
||||
|
||||
$isStudent = false;
|
||||
|
||||
if(!in_array($stg, $granted)){
|
||||
@@ -125,10 +127,10 @@ class Status extends FHC_Controller
|
||||
}
|
||||
|
||||
//Todo(manu) check if this check makes sense?
|
||||
/* if($status_kurzbz != 'Student')
|
||||
{
|
||||
$ausbildungssemester = $lastStatusData->ausbildungssemester;
|
||||
}*/
|
||||
/* if($status_kurzbz != 'Student')
|
||||
{
|
||||
$ausbildungssemester = $lastStatusData->ausbildungssemester;
|
||||
}*/
|
||||
|
||||
//check if Rolle already exists
|
||||
$result = $this->PrestudentstatusModel->checkIfExistingPrestudentRolle($prestudent_id, $status_kurzbz, $studiensemester_kurzbz, $ausbildungssemester);
|
||||
@@ -226,7 +228,6 @@ class Status extends FHC_Controller
|
||||
}
|
||||
}
|
||||
|
||||
//TODO(Manu) check permission...
|
||||
$hasPermissionToSkipStatusCheck = $this->permissionlib->isBerechtigt('student/keine_studdatuspruefung');
|
||||
/* var_dump($hasPermissionToSkipStatusCheck);
|
||||
|
||||
@@ -263,13 +264,9 @@ class Status extends FHC_Controller
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson(getError($result->code));
|
||||
}
|
||||
/* if($result->retval == "0")
|
||||
{
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson($result->code);
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
// Start DB transaction
|
||||
$this->db->trans_start(false);
|
||||
|
||||
@@ -279,9 +276,8 @@ class Status extends FHC_Controller
|
||||
'status_kurzbz' => $status_kurzbz,
|
||||
'bewerbung_abgeschicktamum' => $bewerbung_abgeschicktamum,
|
||||
'studiensemester_kurzbz' => $studiensemester_kurzbz,
|
||||
'studienplan_id' => $studienplan_id,
|
||||
'studienplan_id' => $lastStatusData->studienplan_id,
|
||||
'ausbildungssemester' => $ausbildungssemester,
|
||||
'anmerkung' => $anmerkung,
|
||||
'statusgrund_id' => $statusgrund_id,
|
||||
'insertvon' => $uid,
|
||||
'insertamum' => date('c'),
|
||||
@@ -304,7 +300,6 @@ class Status extends FHC_Controller
|
||||
|
||||
if($isStudent)
|
||||
{
|
||||
//Studentlehrverband anlegen
|
||||
$this->load->model('crm/Student_model', 'StudentModel');
|
||||
$result = $this->StudentModel->checkIfUid($prestudent_id);
|
||||
if (isError($result)) {
|
||||
@@ -313,38 +308,67 @@ class Status extends FHC_Controller
|
||||
}
|
||||
$student_uid = $result->retval;
|
||||
|
||||
//check if Lehrverband exists
|
||||
//load student
|
||||
$result = $this->StudentModel->loadWhere(
|
||||
array(
|
||||
'student_uid' => $student_uid
|
||||
)
|
||||
);
|
||||
if (isError($result)) {
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
$this->outputJson($result);
|
||||
}
|
||||
if (!hasData($result)) {
|
||||
$this->outputJson($result);
|
||||
}
|
||||
$studentData = current(getData($result));
|
||||
$verband = $studentData->verband == '' ? '' : $studentData->verband;
|
||||
$gruppe = $studentData->gruppe == '' ? '' : $studentData->gruppe;
|
||||
|
||||
//check if Studentlehrverband exists
|
||||
$this->load->model('education/Studentlehrverband_model', 'StudentlehrverbandModel');
|
||||
$result = $this->StudentlehrverbandModel->checkIfLehrverbandExists($student_uid, $studiensemester_kurzbz);
|
||||
$result = $this->StudentlehrverbandModel->checkIfStudentLehrverbandExists($student_uid, $studiensemester_kurzbz);
|
||||
if (isError($result)) {
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson(getError($result));
|
||||
}
|
||||
if ($result->retval == "0") {
|
||||
//load Data Lehrverband
|
||||
$result = $this->StudentlehrverbandModel->load(
|
||||
[
|
||||
'student_uid' => $student_uid,
|
||||
'studiensemester_kurzbz' => $studiensemester_kurzbz
|
||||
]);
|
||||
if (isError($result)) {
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
|
||||
return $this->outputJson("Error in insert Studentlehrverband");
|
||||
}
|
||||
$lvbData = current(getData($result));
|
||||
|
||||
if ($result->retval == "0")
|
||||
{
|
||||
$result = $this->StudentlehrverbandModel->insert(
|
||||
[
|
||||
'student_uid' => $student_uid,
|
||||
'studiensemester_kurzbz' => $studiensemester_kurzbz,
|
||||
'semester' => $ausbildungssemester,
|
||||
'verband' => $lvbData->verband,
|
||||
'gruppe' => $lvbData->gruppe,
|
||||
'verband' => $verband,
|
||||
'gruppe' => $gruppe,
|
||||
'insertamum' => date('c'),
|
||||
'insertvon' => $uid,
|
||||
'studiengang_kz' => $lvbData->studiengang_kz
|
||||
'studiengang_kz' => $studentData->studiengang_kz
|
||||
]);
|
||||
|
||||
if (isError($result)) {
|
||||
$this->db->trans_rollback();
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
|
||||
return $this->outputJson("Error in insert Studentlehrverband");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $this->StudentlehrverbandModel->update(
|
||||
[
|
||||
'student_uid' => $student_uid,
|
||||
'studiensemester_kurzbz' => $studiensemester_kurzbz
|
||||
],
|
||||
[
|
||||
'semester' => $ausbildungssemester,
|
||||
'verband' => $verband,
|
||||
'gruppe' => $gruppe,
|
||||
'updateamum' => date('c'),
|
||||
'updatevon' => $uid,
|
||||
'studiengang_kz' => $studentData->studiengang_kz
|
||||
]);
|
||||
|
||||
if (isError($result)) {
|
||||
$this->db->trans_rollback();
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
@@ -354,10 +378,12 @@ class Status extends FHC_Controller
|
||||
}
|
||||
}
|
||||
$this->db->trans_commit();
|
||||
return $this->outputJsonSuccess(true);
|
||||
|
||||
return $this->outputJsonSuccess(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function loadStatus()
|
||||
{
|
||||
$_POST = json_decode(utf8_encode($this->input->raw_input_stream), true);
|
||||
@@ -405,28 +431,28 @@ class Status extends FHC_Controller
|
||||
|
||||
//TODO(Manu) check permissions: warum sind beim Löschen andere Berechtigungen?
|
||||
//ich darf keine Stati anlegen, aber löschen, wenn mehr als einer übrig???
|
||||
/* $granted_Ass = $this->permissionlib->getSTG_isEntitledFor('assistenz');
|
||||
$granted_Adm = $this->permissionlib->getSTG_isEntitledFor('admin');
|
||||
$granted = array_merge($granted_Ass, $granted_Adm);
|
||||
/* $granted_Ass = $this->permissionlib->getSTG_isEntitledFor('assistenz');
|
||||
$granted_Adm = $this->permissionlib->getSTG_isEntitledFor('admin');
|
||||
$granted = array_merge($granted_Ass, $granted_Adm);
|
||||
|
||||
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
$result = $this->PrestudentModel->load([
|
||||
'prestudent_id'=> $prestudent_id,
|
||||
]);
|
||||
if(isError($result))
|
||||
{
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson(getError($result));
|
||||
}
|
||||
$result = current(getData($result));
|
||||
$stg = $result->studiengang_kz;
|
||||
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
$result = $this->PrestudentModel->load([
|
||||
'prestudent_id'=> $prestudent_id,
|
||||
]);
|
||||
if(isError($result))
|
||||
{
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson(getError($result));
|
||||
}
|
||||
$result = current(getData($result));
|
||||
$stg = $result->studiengang_kz;
|
||||
|
||||
if(!in_array($stg, $granted))
|
||||
{
|
||||
$result = "Sie haben keine Schreibrechte fuer diesen Studiengang!";
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson($result);
|
||||
}*/
|
||||
if(!in_array($stg, $granted))
|
||||
{
|
||||
$result = "Sie haben keine Schreibrechte fuer diesen Studiengang!";
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson($result);
|
||||
}*/
|
||||
|
||||
$isBerechtigtAdmin = $this->permissionlib->isBerechtigt('admin', null, 'suid');
|
||||
$isBerechtigtNoStudstatusCheck = $this->permissionlib->isBerechtigt('student/keine_studstatuspruefung', null, 'suid');
|
||||
@@ -564,11 +590,13 @@ class Status extends FHC_Controller
|
||||
|
||||
public function updateStatus($key_prestudent_id, $key_status_kurzbz, $key_studiensemester_kurzbz, $key_ausbildungssemester)
|
||||
{
|
||||
//TODO(Manu) check: Annahme, dass hier immer suid bei Berechtigung STG vergeben wird!
|
||||
$hasPermissionToSkipStatusCheck = $this->permissionlib->isBerechtigt('student/keine_studdatuspruefung');
|
||||
$granted_Ass = $this->permissionlib->getSTG_isEntitledFor('assistenz') ? $this->permissionlib->getSTG_isEntitledFor('assistenz') : [];
|
||||
$granted_Adm = $this->permissionlib->getSTG_isEntitledFor('admin') ? $this->permissionlib->getSTG_isEntitledFor('admin') : [];
|
||||
$granted = array_merge($granted_Ass, $granted_Adm);
|
||||
|
||||
$isStudent = false;
|
||||
|
||||
//get Studiengang von prestudent_id
|
||||
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
$result = $this->PrestudentModel->load([
|
||||
@@ -588,6 +616,9 @@ class Status extends FHC_Controller
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson($result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//var_dump($key_prestudent_id, $key_status_kurzbz, $key_studiensemester_kurzbz, $key_ausbildungssemester);
|
||||
|
||||
/* $this->load->library('form_validation');
|
||||
@@ -615,57 +646,134 @@ class Status extends FHC_Controller
|
||||
$rt_stufe = $this->input->post('rt_stufe');
|
||||
$bestaetigtvon = $uid;
|
||||
|
||||
// Start DB transaction
|
||||
//$this->db->trans_start(false);
|
||||
//check if Bismeldestichtag erreicht
|
||||
if(!$hasPermissionToSkipStatusCheck)
|
||||
{
|
||||
$this->load->model('codex/Bismeldestichtag_model', 'BismeldestichtagModel');
|
||||
$result = $this->BismeldestichtagModel->checkIfMeldestichtagErreicht($datum, $studiensemester_kurzbz);
|
||||
if (isError($result)) {
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson(getError($result));
|
||||
}
|
||||
if ($result->retval == "1") {
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
//return $this->outputJson(getError($result->code));
|
||||
//Fehlermeldung überschrieben, passender
|
||||
return $this->outputJson("Meldestichtag erreicht - Bearbeiten nicht mehr möglich");
|
||||
}
|
||||
}
|
||||
|
||||
//check if Rolle already exists
|
||||
if(($key_studiensemester_kurzbz != $studiensemester_kurzbz)
|
||||
|| ($key_ausbildungssemester != $ausbildungssemester))
|
||||
{
|
||||
$result = $this->PrestudentstatusModel->checkIfExistingPrestudentRolle($prestudent_id, $status_kurzbz, $studiensemester_kurzbz, $ausbildungssemester);
|
||||
if (isError($result))
|
||||
{
|
||||
$result = $this->PrestudentstatusModel->checkIfExistingPrestudentRolle($prestudent_id, $status_kurzbz, $studiensemester_kurzbz, $ausbildungssemester);
|
||||
if (isError($result))
|
||||
{
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson(getError($result));
|
||||
}
|
||||
if($result->retval == '1')
|
||||
{
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson($result->code);
|
||||
}
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson(getError($result));
|
||||
}
|
||||
if($result->retval == '1')
|
||||
{
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson($result->code);
|
||||
}
|
||||
}
|
||||
|
||||
//check if studentrolle already exists
|
||||
if($status_kurzbz == 'Student')
|
||||
{
|
||||
$this->load->model('crm/Student_model', 'StudentModel');
|
||||
$result = $this->StudentModel->checkIfExistingStudentRolle($prestudent_id);
|
||||
if (isError($result))
|
||||
{
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson(getError($result));
|
||||
}
|
||||
if($result->retval == "0")
|
||||
{
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson($result->code);
|
||||
}
|
||||
if($result->retval != "0")
|
||||
{
|
||||
$isStudent = true;
|
||||
}
|
||||
}
|
||||
|
||||
//TODO(Manu) check permissions
|
||||
$hasPermissionToSkipStatusCheck = $this->permissionlib->isBerechtigt('student/keine_studdatuspruefung');
|
||||
/* var_dump($hasPermissionToSkipStatusCheck);
|
||||
|
||||
$basis = $this->permissionlib->isBerechtigt('basis/prestudent');
|
||||
var_dump($basis);*/
|
||||
if(!$hasPermissionToSkipStatusCheck)
|
||||
{
|
||||
//Block STATUSCHECKS
|
||||
//bei update wohl nicht?
|
||||
/* $new_status_datum = isset($datum) ? $datum : date('Y-m-d');
|
||||
$result = $this->PrestudentstatusModel->checkDatumNewStatus($new_status_datum);
|
||||
|
||||
//$new_status_datum = isset($datum) ? $datum : date('Y-m-d');
|
||||
|
||||
$result = $this->PrestudentstatusModel->checkIfValidStatusHistory($prestudent_id, $status_kurzbz, $studiensemester_kurzbz, $datum, $ausbildungssemester);
|
||||
if (isError($result))
|
||||
{
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson(getError($result));
|
||||
}*/
|
||||
|
||||
$new_status_datum = isset($datum) ? $datum : date('Y-m-d');
|
||||
|
||||
$result = $this->PrestudentstatusModel->checkIfValidStatusHistory($prestudent_id, $status_kurzbz, $studiensemester_kurzbz, $new_status_datum, $ausbildungssemester);
|
||||
if (isError($result))
|
||||
{
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson(getError($result));
|
||||
//return $this->outputJson("DEBUG: in Funktion checkIfValidStatusHistory");
|
||||
}
|
||||
$statusArr = $result; //wenn return result ok
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Start DB transaction
|
||||
$this->db->trans_start(false);
|
||||
|
||||
if($isStudent)
|
||||
{
|
||||
//Studentlehrverband anlegen
|
||||
$this->load->model('crm/Student_model', 'StudentModel');
|
||||
$result = $this->StudentModel->checkIfUid($prestudent_id);
|
||||
if (isError($result)) {
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson(getError($result));
|
||||
}
|
||||
$student_uid = $result->retval;
|
||||
|
||||
//check if Lehrverband exists
|
||||
$this->load->model('education/Studentlehrverband_model', 'StudentlehrverbandModel');
|
||||
$result = $this->StudentlehrverbandModel->checkIfLehrverbandExists($student_uid, $studiensemester_kurzbz);
|
||||
if (isError($result)) {
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson(getError($result));
|
||||
}
|
||||
if ($result->retval == "0") {
|
||||
//load Data Studentlehrverband
|
||||
$result = $this->StudentlehrverbandModel->load(
|
||||
[
|
||||
'student_uid' => $student_uid,
|
||||
'studiensemester_kurzbz' => $studiensemester_kurzbz
|
||||
]);
|
||||
if (isError($result)) {
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
|
||||
return $this->outputJson("Error in insert Studentlehrverband");
|
||||
}
|
||||
$lvbData = current(getData($result));
|
||||
|
||||
$result = $this->StudentlehrverbandModel->insert(
|
||||
[
|
||||
'student_uid' => $student_uid,
|
||||
'studiensemester_kurzbz' => $studiensemester_kurzbz,
|
||||
'semester' => $ausbildungssemester,
|
||||
'verband' => $lvbData->verband,
|
||||
'gruppe' => $lvbData->gruppe,
|
||||
'insertamum' => date('c'),
|
||||
'insertvon' => $uid,
|
||||
'studiengang_kz' => $lvbData->studiengang_kz
|
||||
]);
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
|
||||
return $this->outputJson("Error in insert Studentlehrverband");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//update status
|
||||
$result = $this->PrestudentstatusModel->update(
|
||||
[
|
||||
'prestudent_id' => $key_prestudent_id,
|
||||
@@ -690,20 +798,24 @@ class Status extends FHC_Controller
|
||||
'rt_stufe' => $rt_stufe
|
||||
]
|
||||
);
|
||||
if (isError($result))
|
||||
|
||||
// Transaction complete!
|
||||
$this->db->trans_complete();
|
||||
|
||||
if ($this->db->trans_status() === false || isError($result))
|
||||
{
|
||||
$this->db->trans_rollback();
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson(getError($result));
|
||||
}
|
||||
if (!hasData($result)) {
|
||||
return error('No Statusdata vorhanden');
|
||||
}
|
||||
|
||||
|
||||
$this->db->trans_commit();
|
||||
return $this->outputJsonSuccess(true);
|
||||
}
|
||||
|
||||
public function advanceStatus($key_prestudent_id, $key_status_kurzbz, $key_studiensemester_kurzbz, $key_ausbildungssemester)
|
||||
{
|
||||
//TODO(Manu) check: Annahme, dass hier immer suid bei Berechtigung STG vergeben wird!
|
||||
$granted_Ass = $this->permissionlib->getSTG_isEntitledFor('assistenz') ? $this->permissionlib->getSTG_isEntitledFor('assistenz') : [];
|
||||
$granted_Adm = $this->permissionlib->getSTG_isEntitledFor('admin') ? $this->permissionlib->getSTG_isEntitledFor('admin') : [];
|
||||
$granted = array_merge($granted_Ass, $granted_Adm);
|
||||
@@ -827,6 +939,7 @@ class Status extends FHC_Controller
|
||||
return $this->outputJson(getError($result));
|
||||
}
|
||||
|
||||
//TodoManu -> check if student, was wenn kein Studentstatus
|
||||
//Studentlehrverband anlegen
|
||||
$this->load->model('crm/Student_model', 'StudentModel');
|
||||
$result = $this->StudentModel->checkIfUid($key_prestudent_id);
|
||||
@@ -837,9 +950,9 @@ class Status extends FHC_Controller
|
||||
}
|
||||
$student_uid = $result->retval;
|
||||
|
||||
//check if Lehrverband exists
|
||||
//check if Studentehrverband exists
|
||||
$this->load->model('education/Studentlehrverband_model', 'StudentlehrverbandModel');
|
||||
$result = $this->StudentlehrverbandModel->checkIfLehrverbandExists($student_uid, $studiensem_next);
|
||||
$result = $this->StudentlehrverbandModel->checkIfStudentlehrverbandExists($student_uid, $studiensem_next);
|
||||
if (isError($result))
|
||||
{
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
@@ -847,7 +960,7 @@ class Status extends FHC_Controller
|
||||
}
|
||||
if ($result->retval == "0")
|
||||
{
|
||||
//load Data Lehrverband
|
||||
//load Data Studentlehrverband
|
||||
$result = $this->StudentlehrverbandModel->load(
|
||||
[
|
||||
'student_uid' => $student_uid,
|
||||
@@ -860,6 +973,7 @@ class Status extends FHC_Controller
|
||||
return $this->outputJson("Error in insert Studentlehrverband");
|
||||
}
|
||||
$lvbData = current(getData($result));
|
||||
var_dump($lvbData);
|
||||
|
||||
$result = $this->StudentlehrverbandModel->insert(
|
||||
[
|
||||
@@ -881,6 +995,7 @@ class Status extends FHC_Controller
|
||||
}
|
||||
}
|
||||
$this->db->trans_commit();
|
||||
|
||||
return $this->outputJsonSuccess(true);
|
||||
}
|
||||
|
||||
@@ -961,7 +1076,9 @@ class Status extends FHC_Controller
|
||||
],
|
||||
[
|
||||
'bestaetigtam' => date('c'),
|
||||
'bestaetigtvon' => $uid
|
||||
'bestaetigtvon' => $uid,
|
||||
'updateamum='=> date('c'),
|
||||
'updatevon=' => $uid
|
||||
]
|
||||
);
|
||||
if (isError($result))
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
class Bismeldestichtag_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@@ -54,9 +53,29 @@ class Bismeldestichtag_model extends DB_Model
|
||||
* @param $status_datum
|
||||
* @return boolean true wenn erreicht, oder false
|
||||
*/
|
||||
public function checkIfMeldestichtagErreicht($status_datum)
|
||||
public function checkIfMeldestichtagErreicht($status_datum, $studiensemester_kurzbz = null)
|
||||
{
|
||||
$erreicht = false;
|
||||
|
||||
if (isset($studiensemester_kurzbz))
|
||||
{
|
||||
// Studiensemesterende holen
|
||||
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
|
||||
$result = $this->StudiensemesterModel->loadWhere(
|
||||
array(
|
||||
'studiensemester_kurzbz' => $studiensemester_kurzbz
|
||||
)
|
||||
);
|
||||
if(isError($result))
|
||||
{
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson(getError($result));
|
||||
}
|
||||
$result = current(getData($result));
|
||||
|
||||
$studiensemester_ende = $result->ende;
|
||||
}
|
||||
|
||||
// letztes erreichtes Bismeldedatum holen
|
||||
$result = $this->getLastReachedMeldestichtag();
|
||||
if (isError($result))
|
||||
@@ -68,7 +87,6 @@ class Bismeldestichtag_model extends DB_Model
|
||||
}
|
||||
$stichtag = current(getData($result));
|
||||
$stichtag = $stichtag->meldestichtag;
|
||||
var_dump($status_datum . " < " . $stichtag . "?");
|
||||
|
||||
// Prüfen, ob Studentstatusdatum oder Studiensemester vor dem Stichtagsdatum liegen
|
||||
if (isset($statusDatum))
|
||||
@@ -77,6 +95,11 @@ class Bismeldestichtag_model extends DB_Model
|
||||
$erreicht = $statusDatum < $stichtag;
|
||||
}
|
||||
|
||||
if (isset($studiensemester_ende))
|
||||
{
|
||||
$erreicht = $erreicht || $studiensemester_ende < $stichtag;
|
||||
}
|
||||
|
||||
if($erreicht)
|
||||
return success("1", "Studentstatus mit Datum oder Semesterende vor erreichtem Meldestichtag können nicht hinzugefügt werden");
|
||||
|
||||
|
||||
@@ -14,14 +14,12 @@ class Studentlehrverband_model extends DB_Model
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Rolle already exists
|
||||
* @param integer $prestudent_id
|
||||
* @param string $status_kurzbz
|
||||
* Check if Studentlehrverband already exists
|
||||
* @param string $student_id
|
||||
* @param string $studiensemester_kurzbz
|
||||
* @param integer $ausbildungssemester
|
||||
* @return 1: if Rolle exists, 0: if it doesn't
|
||||
*/
|
||||
public function checkIfLehrverbandExists($student_uid, $studiensemester_kurzbz)
|
||||
public function checkIfStudentlehrverbandExists($student_uid, $studiensemester_kurzbz)
|
||||
{
|
||||
$qry = "SELECT
|
||||
*
|
||||
@@ -40,11 +38,11 @@ class Studentlehrverband_model extends DB_Model
|
||||
}
|
||||
elseif (!hasData($result))
|
||||
{
|
||||
return success("0", "Kein Lehrverband vorhanden!");
|
||||
return success("0", "Kein Studentlehrverband vorhanden!");
|
||||
}
|
||||
else
|
||||
{
|
||||
return success("1","Lehrverband vorhanden!");
|
||||
return success("1","Studentlehrverband vorhanden!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,4 +11,37 @@ class Lehrverband_model extends DB_Model
|
||||
$this->dbTable = 'public.tbl_lehrverband';
|
||||
$this->pk = array('gruppe', 'verband', 'semester', 'studiengang_kz');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Lehrverband already exists
|
||||
* @param string $student_id
|
||||
* @param string $studiensemester_kurzbz
|
||||
* @return 1: if Rolle exists, 0: if it doesn't
|
||||
*/
|
||||
public function checkIfLehrverbandExists($student_uid, $studiensemester_kurzbz)
|
||||
{
|
||||
$qry = "SELECT
|
||||
*
|
||||
FROM
|
||||
public.tbl_studentlehrverband
|
||||
WHERE
|
||||
student_uid = ?
|
||||
AND
|
||||
studiensemester_kurzbz = ?";
|
||||
|
||||
$result = $this->execQuery($qry, array($student_uid, $studiensemester_kurzbz));
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
return error($result);
|
||||
}
|
||||
elseif (!hasData($result))
|
||||
{
|
||||
return success("0", "Kein Lehrverband vorhanden!");
|
||||
}
|
||||
else
|
||||
{
|
||||
return success("1","Lehrverband vorhanden!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,13 @@ html {
|
||||
width: 0%;
|
||||
}
|
||||
|
||||
.tabulator-row.disabled.tabulator-row-odd .tabulator-cell {
|
||||
color: var(--gray-400);
|
||||
}
|
||||
.tabulator-row.disabled.tabulator-row-even .tabulator-cell {
|
||||
color: var(--gray-500);
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
#sidebarMenu {
|
||||
visibility: visible!important;
|
||||
|
||||
@@ -71,11 +71,20 @@ export default{
|
||||
title: 'Aktionen', field: 'actions',
|
||||
minWidth: 150, // Ensures Action-buttons will be always fully displayed
|
||||
formatter: (cell, formatterParams, onRendered) => {
|
||||
|
||||
|
||||
//let disableButton = false;
|
||||
//const rowData = this.row.getData();
|
||||
|
||||
|
||||
let container = document.createElement('div');
|
||||
container.className = "d-flex gap-2";
|
||||
|
||||
let button = document.createElement('button');
|
||||
button.className = 'btn btn-outline-secondary btn-action';
|
||||
if (this.dataMeldestichtag && this.dataMeldestichtag > cell.getData().datum)
|
||||
button.className = 'btn btn-outline-secondary btn-action disabled';
|
||||
else
|
||||
button.className = 'btn btn-outline-secondary btn-action';
|
||||
button.innerHTML = '<i class="fa fa-forward"></i>';
|
||||
button.title = 'Status vorrücken';
|
||||
button.addEventListener('click', () =>
|
||||
@@ -84,7 +93,10 @@ export default{
|
||||
container.append(button);
|
||||
|
||||
button = document.createElement('button');
|
||||
button.className = 'btn btn-outline-secondary btn-action';
|
||||
if (this.dataMeldestichtag && this.dataMeldestichtag > cell.getData().datum)
|
||||
button.className = 'btn btn-outline-secondary btn-action disabled';
|
||||
else
|
||||
button.className = 'btn btn-outline-secondary btn-action';
|
||||
button.innerHTML = '<i class="fa fa-check"></i>';
|
||||
button.title = 'Status bestätigen';
|
||||
button.addEventListener('click', () =>
|
||||
@@ -93,7 +105,10 @@ export default{
|
||||
container.append(button);
|
||||
|
||||
button = document.createElement('button');
|
||||
button.className = 'btn btn-outline-secondary btn-action';
|
||||
if (this.dataMeldestichtag && this.dataMeldestichtag > cell.getData().datum)
|
||||
button.className = 'btn btn-outline-secondary btn-action disabled';
|
||||
else
|
||||
button.className = 'btn btn-outline-secondary btn-action';
|
||||
button.innerHTML = '<i class="fa fa-edit"></i>';
|
||||
button.title = 'Status bearbeiten';
|
||||
button.addEventListener('click', (event) =>
|
||||
@@ -102,7 +117,10 @@ export default{
|
||||
container.append(button);
|
||||
|
||||
button = document.createElement('button');
|
||||
button.className = 'btn btn-outline-secondary btn-action';
|
||||
if (this.dataMeldestichtag && this.dataMeldestichtag > cell.getData().datum)
|
||||
button.className = 'btn btn-outline-secondary btn-action disabled';
|
||||
else
|
||||
button.className = 'btn btn-outline-secondary btn-action';
|
||||
button.innerHTML = '<i class="fa fa-xmark"></i>';
|
||||
button.title = 'Status löschen';
|
||||
button.addEventListener('click', () =>
|
||||
@@ -115,6 +133,14 @@ export default{
|
||||
frozen: true
|
||||
},
|
||||
],
|
||||
rowFormatter: (row) => {
|
||||
const rowData = row.getData();
|
||||
if (this.dataMeldestichtag && this.dataMeldestichtag > rowData.datum)
|
||||
{
|
||||
row.getElement().classList.add('disabled');
|
||||
|
||||
}
|
||||
},
|
||||
layout: 'fitDataFill',
|
||||
layoutColumnsOnNewData: false,
|
||||
height: 'auto',
|
||||
@@ -128,17 +154,15 @@ export default{
|
||||
aufnahmestufen: {'': '-- keine Auswahl --', 1: 1, 2: 2, 3: 3},
|
||||
listStatusgruende: [],
|
||||
statusId: {},
|
||||
gruendeLength: {}
|
||||
gruendeLength: {},
|
||||
dataMeldestichtag: null,
|
||||
stichtag: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
gruende() {
|
||||
return this.listStatusgruende.filter(grund => grund.status_kurzbz == this.statusData.status_kurzbz);
|
||||
},
|
||||
/* gruendeLength() {
|
||||
//return Object.keys(this.gruende).length;
|
||||
return 33;
|
||||
}*/
|
||||
},
|
||||
watch: {
|
||||
data: {
|
||||
@@ -185,16 +209,6 @@ export default{
|
||||
if(this.statusData)
|
||||
this.$refs.deleteStatusModal.show();
|
||||
});
|
||||
|
||||
/* this.loadStatus({
|
||||
'prestudent_id': this.prestudent_id,
|
||||
'status_kurzbz': status,
|
||||
'studiensemester_kurzbz': stdsem,
|
||||
'ausbildungssemester': ausbildungssemester
|
||||
}).then(() => {
|
||||
if(this.statusData)
|
||||
this.$refs.deleteStatusModal.show();
|
||||
});*/
|
||||
},
|
||||
actionAdvanceStatus(status, stdsem, ausbildungssemester){
|
||||
console.log("Action: Status vorrücken: (" + status + ": " + stdsem + "/" + ausbildungssemester + ")")
|
||||
@@ -227,7 +241,7 @@ export default{
|
||||
addNewStatus(){
|
||||
CoreRESTClient.post('components/stv/Status/addNewStatus/' + this.prestudent_id,
|
||||
this.statusData
|
||||
).then(response => {
|
||||
).then(response => {
|
||||
if (!response.data.error) {
|
||||
this.$fhcAlert.alertSuccess('Speichern erfolgreich');
|
||||
this.hideModal('newStatusModal');
|
||||
@@ -318,7 +332,7 @@ export default{
|
||||
const errorData = result.data.retval;
|
||||
this.$fhcAlert.alertError('Kein Status mit Id ' + status_id + ' gefunden');
|
||||
}
|
||||
/* return result;*/
|
||||
/* return result;*/
|
||||
}).catch(error => {
|
||||
if (error.response) {
|
||||
//console.log(error.response);
|
||||
@@ -412,16 +426,25 @@ export default{
|
||||
this.listStatusgruende = result;
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
CoreRESTClient
|
||||
.get('components/stv/Status/getLastBismeldestichtag/')
|
||||
.then(result => CoreRESTClient.getData(result.data) || [])
|
||||
.then(result => {
|
||||
this.dataMeldestichtag = result[0].meldestichtag;
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
},
|
||||
template: `
|
||||
<div class="stv-list h-100 pt-3">
|
||||
|
||||
|
||||
<p>TestData</p>
|
||||
{{statusData}}
|
||||
<hr>
|
||||
{{gruende}}
|
||||
{{gruendeLength}}
|
||||
|
||||
Bismeldestichtag
|
||||
{{dataMeldestichtag }}
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Berechtigungen:
|
||||
Skip Check: {{hasPermissionToSkipStatusCheck}} |
|
||||
@@ -602,6 +625,10 @@ export default{
|
||||
<template #title>Status bearbeiten</template>
|
||||
<form-form class="row g-3" ref="statusData">
|
||||
|
||||
<div v-if="statusData.datum < dataMeldestichtag ">
|
||||
<b>Meldestichtag erreicht - Bearbeiten nicht mehr möglich</b>
|
||||
</div>
|
||||
|
||||
<input type="hidden" id="statusId" name="statusId" value="statusData.statusId">
|
||||
|
||||
<div class="row mb-3">
|
||||
|
||||
Reference in New Issue
Block a user