mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 08:22:17 +00:00
Refactor Logic Statuschanges
This commit is contained in:
@@ -21,6 +21,9 @@ class Status extends FHCAPI_Controller
|
||||
'confirmStatus' => ['admin:r', 'assistenz:r']
|
||||
]);
|
||||
|
||||
//Load Models
|
||||
$this->load->model('crm/Prestudentstatus_model','PrestudentstatusModel');
|
||||
|
||||
// Load Libraries
|
||||
$this->load->library('VariableLib', ['uid' => getAuthUID()]);
|
||||
$this->load->library('PrestudentstatusCheckLib');
|
||||
@@ -74,7 +77,6 @@ class Status extends FHCAPI_Controller
|
||||
|
||||
public function isLastStatus($prestudent_id)
|
||||
{
|
||||
$this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel');
|
||||
$result = $this->PrestudentstatusModel->checkIfLastStatusEntry($prestudent_id);
|
||||
|
||||
|
||||
@@ -103,12 +105,7 @@ class Status extends FHCAPI_Controller
|
||||
}
|
||||
$result = current(getData($result));
|
||||
|
||||
//Variablen für Statuscheck
|
||||
$stg = $result->studiengang_kz;
|
||||
$reihungstest_angetreten = $result->reihungstestangetreten;
|
||||
$name = trim($result->vorname . " ". $result->nachname);
|
||||
$zgv_code = $result->zgv_code;
|
||||
|
||||
$isStudent = false;
|
||||
|
||||
if(!$this->permissionlib->isBerechtigt('admin', 'suid', $stg) && !$this->permissionlib->isBerechtigt('assistenz', 'suid', $stg))
|
||||
@@ -119,7 +116,6 @@ class Status extends FHCAPI_Controller
|
||||
}
|
||||
|
||||
$_POST = json_decode(utf8_encode($this->input->raw_input_stream), true);
|
||||
$this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel');
|
||||
|
||||
$uid = getAuthUID();
|
||||
$status_kurzbz = $this->input->post('status_kurzbz');
|
||||
@@ -135,8 +131,6 @@ class Status extends FHCAPI_Controller
|
||||
$bestaetigtvon = $uid;
|
||||
$name = $this->input->post('name');
|
||||
|
||||
|
||||
|
||||
//Form Validation
|
||||
$this->load->library('form_validation');
|
||||
|
||||
@@ -162,13 +156,13 @@ class Status extends FHCAPI_Controller
|
||||
$lastStatusData = current(getData($result));
|
||||
|
||||
//Different handling depending on newStatus
|
||||
if($status_kurzbz == 'Absolvent' || $status_kurzbz == 'Diplomand')
|
||||
if($status_kurzbz == Prestudentstatus_model::STATUS_ABSOLVENT || $status_kurzbz == Prestudentstatus_model::STATUS_DIPLOMAND)
|
||||
{
|
||||
$ausbildungssemester = $lastStatusData->ausbildungssemester;
|
||||
}
|
||||
|
||||
//check if Rolle already exists
|
||||
$result = $this->PrestudentstatusModel->checkIfExistingPrestudentRolle(
|
||||
$result = $this->prestudentstatuschecklib->checkIfExistingPrestudentRolle(
|
||||
$prestudent_id,
|
||||
$status_kurzbz,
|
||||
$studiensemester_kurzbz,
|
||||
@@ -180,30 +174,33 @@ class Status extends FHCAPI_Controller
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
|
||||
if(getData($result) == '1')
|
||||
{
|
||||
return $this->terminateWithError($name . ": " . $this->p->t('lehre','error_rolleBereitsVorhanden'), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
|
||||
|
||||
//Check Reihungstest
|
||||
if(REIHUNGSTEST_CHECK)
|
||||
{
|
||||
if($status_kurzbz=='Bewerber' && !$reihungstest_angetreten)
|
||||
if($status_kurzbz==Prestudentstatus_model::STATUS_BEWERBER)
|
||||
{
|
||||
return $this->terminateWithError($this->p->t('lehre','error_keinReihungstestverfahren', ['name' => $name]), self::ERROR_TYPE_GENERAL);
|
||||
$result = $this->prestudentstatuschecklib->checkIfAngetreten($prestudent_id);
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Check ZGV
|
||||
if(!defined("ZGV_CHECK") || ZGV_CHECK)
|
||||
{
|
||||
if($status_kurzbz=='Bewerber' && $zgv_code=='')
|
||||
if($status_kurzbz==Prestudentstatus_model::STATUS_BEWERBER)
|
||||
{
|
||||
return $this->terminateWithError($this->p->t('lehre','error_ZGVNichtEingetragen', ['name' => $name]), self::ERROR_TYPE_GENERAL);
|
||||
$result = $this->prestudentstatuschecklib->checkIfZGVEingetragen($prestudent_id);
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Check ZGV-Master
|
||||
$this->load->model('organisation/Studiengang_model', 'StudiengangModel');
|
||||
$result = $this->StudiengangModel->load([
|
||||
@@ -219,44 +216,36 @@ class Status extends FHCAPI_Controller
|
||||
|
||||
if(!defined("ZGV_CHECK") || ZGV_CHECK)
|
||||
{
|
||||
if($status_kurzbz=='Bewerber' && $zgv_code=='' && $typ=='m')
|
||||
if($status_kurzbz==Prestudentstatus_model::STATUS_BEWERBER && $typ=='m')
|
||||
{
|
||||
return $this->terminateWithError($this->p->t('lehre','error_ZGVMasterNichtEingetragen', ['name' => $name]), self::ERROR_TYPE_GENERAL);
|
||||
$result = $this->prestudentstatuschecklib->checkIfZGVEingetragen($prestudent_id, $typ);
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//check if bewerberstatus exists
|
||||
if($status_kurzbz == 'Aufgenommener' || $status_kurzbz == 'Wartender')
|
||||
if($status_kurzbz == Prestudentstatus_model::STATUS_AUFGENOMMENER || $status_kurzbz == Prestudentstatus_model::STATUS_WARTENDER)
|
||||
{
|
||||
|
||||
$result = $this->PrestudentstatusModel->checkIfExistingBewerberstatus($prestudent_id, $name);
|
||||
$result = $result = $this->prestudentstatuschecklib->checkIfExistingBewerberstatus($prestudent_id);
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
if($result->retval == "0")
|
||||
{
|
||||
return $this->terminateWithError($this->p->t('lehre','error_keinBewerber', ['name' => $name]), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
}
|
||||
|
||||
//check if studentrolle already exists
|
||||
if($status_kurzbz == 'Student' || $status_kurzbz == 'Diplomand' || $lastStatusData->status_kurzbz == 'Student')
|
||||
if($status_kurzbz == Prestudentstatus_model::STATUS_STUDENT || $status_kurzbz == Prestudentstatus_model::STATUS_DIPLOMAND || $lastStatusData->status_kurzbz == Prestudentstatus_model::STATUS_STUDENT)
|
||||
{
|
||||
$this->load->model('crm/Student_model', 'StudentModel');
|
||||
$result = $this->StudentModel->checkIfExistingStudentRolle($prestudent_id);
|
||||
$result = $this->prestudentstatuschecklib->checkIfExistingStudentRolle($prestudent_id);
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
if($result->retval == "0")
|
||||
{
|
||||
return $this->terminateWithError($this->p->t('lehre','error_noStudstatus'), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
if($result->retval != "0")
|
||||
{
|
||||
$isStudent = true;
|
||||
}
|
||||
$isStudent = true;
|
||||
}
|
||||
|
||||
$isBerechtigtNoStudstatusCheck = $this->permissionlib->isBerechtigt('student/keine_studstatuspruefung');
|
||||
@@ -280,45 +269,71 @@ class Status extends FHCAPI_Controller
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
|
||||
//check if Bismeldestichtag erreicht
|
||||
$this->load->model('codex/Bismeldestichtag_model', 'BismeldestichtagModel');
|
||||
$result = $this->BismeldestichtagModel->checkIfMeldestichtagErreicht($new_status_datum);
|
||||
//TODO(manu) check Berechtigung
|
||||
//check if Bismeldestichtag erreicht ADDNEW status
|
||||
$result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($new_status_datum, $studiensemester_kurzbz);
|
||||
return $this->terminateWithError("here", self::ERROR_TYPE_GENERAL);
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
if($result->retval == "1")
|
||||
{
|
||||
return $this->terminateWithError($this->p->t('lehre','error_dataVorMeldestichtag'), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
}
|
||||
|
||||
//different handling of StudStati
|
||||
if($status_kurzbz == 'Abbrecher')
|
||||
{
|
||||
$studiensemester_kurzbz = $lastStatusData->studiensemester_kurzbz;
|
||||
//TODO(Manu) DELETE
|
||||
// $new_status_datum = isset($datum) ? $datum : date('Y-m-d');
|
||||
|
||||
$this->load->model('crm/Statusgrund_model', 'StatusgrundModel');
|
||||
$result = $this->StatusgrundModel->load($statusgrund_id);
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
$result = current(getData($result));
|
||||
$statusgrund_kurzbz = $result->statusgrund_kurzbz;
|
||||
// $result = $this->prestudentstatuschecklib->checkStatusAdd(
|
||||
// $prestudent_id,
|
||||
// $status_kurzbz,
|
||||
// $studiensemester_kurzbz,
|
||||
// $new_status_datum,
|
||||
// $ausbildungssemester,
|
||||
// $studienplan_id
|
||||
// );
|
||||
|
||||
$this->load->library('PrestudentLib');
|
||||
$result = $this->prestudentlib->setAbbrecher($prestudent_id, $studiensemester_kurzbz, null, $statusgrund_kurzbz, $datum, $bestaetigtam, $bestaetigtvon);
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
else
|
||||
$this->terminateWithSuccess($prestudent_id);
|
||||
}
|
||||
// if (isError($result))
|
||||
// {
|
||||
// return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
// }
|
||||
|
||||
// $this->load->model('codex/Bismeldestichtag_model', 'BismeldestichtagModel');
|
||||
// $result = $this->BismeldestichtagModel->checkIfMeldestichtagErreicht($datum, $studiensemester_kurzbz);
|
||||
// return $this->terminateWithError("retval: " . $result->retval, self::ERROR_TYPE_GENERAL);
|
||||
|
||||
// if (isError($result))
|
||||
// {
|
||||
// return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
// }
|
||||
// if ($result->retval == "1")
|
||||
// {
|
||||
// return $this->terminateWithError($this->p->t('lehre','error_dataVorMeldestichtag'), self::ERROR_TYPE_GENERAL);
|
||||
// }
|
||||
|
||||
switch($status_kurzbz){
|
||||
case 'Unterbrecher':
|
||||
case Prestudentstatus_model::STATUS_ABBRECHER:
|
||||
{
|
||||
$studiensemester_kurzbz = $lastStatusData->studiensemester_kurzbz;
|
||||
|
||||
$this->load->model('crm/Statusgrund_model', 'StatusgrundModel');
|
||||
$result = $this->StatusgrundModel->load($statusgrund_id);
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
$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))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
else
|
||||
$this->terminateWithSuccess($prestudent_id);
|
||||
}
|
||||
break;
|
||||
case Prestudentstatus_model::STATUS_UNTERBRECHER:
|
||||
{
|
||||
$ausbildungssemester = $lastStatusData->ausbildungssemester;
|
||||
$studiensemester_kurzbz = $lastStatusData->studiensemester_kurzbz;
|
||||
@@ -333,46 +348,47 @@ class Status extends FHCAPI_Controller
|
||||
$this->terminateWithSuccess($prestudent_id);
|
||||
}
|
||||
break;
|
||||
case 'Student':
|
||||
{
|
||||
$this->load->library('PrestudentLib');
|
||||
$result = $this->prestudentlib->setStudent($prestudent_id, $studiensemester_kurzbz, $ausbildungssemester, $statusgrund_id, $bestaetigtam, $bestaetigtvon);
|
||||
|
||||
if (isError($result))
|
||||
case Prestudentstatus_model::STATUS_STUDENT:
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
$this->load->library('PrestudentLib');
|
||||
$result = $this->prestudentlib->setStudent($prestudent_id, $studiensemester_kurzbz, $ausbildungssemester, $statusgrund_id, $bestaetigtam, $bestaetigtvon);
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
else
|
||||
$this->terminateWithSuccess($prestudent_id);
|
||||
|
||||
}
|
||||
else
|
||||
$this->terminateWithSuccess($prestudent_id);
|
||||
|
||||
}
|
||||
break;
|
||||
case 'Diplomand':
|
||||
{
|
||||
$this->load->library('PrestudentLib');
|
||||
$result = $this->prestudentlib->setDiplomand($prestudent_id, $studiensemester_kurzbz, $ausbildungssemester);
|
||||
|
||||
if (isError($result))
|
||||
break;
|
||||
case Prestudentstatus_model::STATUS_DIPLOMAND:
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
else
|
||||
$this->terminateWithSuccess($prestudent_id);
|
||||
}
|
||||
break;
|
||||
case 'Absolvent':
|
||||
{
|
||||
$this->load->library('PrestudentLib');
|
||||
$result = $this->prestudentlib->setAbsolvent($prestudent_id, $studiensemester_kurzbz, $ausbildungssemester);
|
||||
$this->load->library('PrestudentLib');
|
||||
$result = $this->prestudentlib->setDiplomand($prestudent_id, $studiensemester_kurzbz, $ausbildungssemester);
|
||||
|
||||
if (isError($result))
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
else
|
||||
$this->terminateWithSuccess($prestudent_id);
|
||||
}
|
||||
break;
|
||||
case Prestudentstatus_model::STATUS_ABSOLVENT:
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
else
|
||||
$this->terminateWithSuccess($prestudent_id);
|
||||
$this->load->library('PrestudentLib');
|
||||
$result = $this->prestudentlib->setAbsolvent($prestudent_id, $studiensemester_kurzbz, $ausbildungssemester);
|
||||
|
||||
}
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
else
|
||||
$this->terminateWithSuccess($prestudent_id);
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
/* if ($isStudent) {
|
||||
@@ -414,8 +430,6 @@ class Status extends FHCAPI_Controller
|
||||
$ausbildungssemester = $this->input->post('ausbildungssemester');
|
||||
$studiensemester_kurzbz = $this->input->post('studiensemester_kurzbz');
|
||||
|
||||
$this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel');
|
||||
|
||||
$result = $this->PrestudentstatusModel->loadWhere(
|
||||
array(
|
||||
'prestudent_id' => $prestudent_id,
|
||||
@@ -441,9 +455,6 @@ class Status extends FHCAPI_Controller
|
||||
|
||||
public function deleteStatus()
|
||||
{
|
||||
|
||||
$this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel');
|
||||
|
||||
$_POST = json_decode(utf8_encode($this->input->raw_input_stream), true);
|
||||
|
||||
$prestudent_id = $this->input->post('prestudent_id');
|
||||
@@ -467,14 +478,14 @@ class Status extends FHCAPI_Controller
|
||||
|
||||
$isBerechtigtAdmin = $this->permissionlib->isBerechtigt('admin', null, 'suid');
|
||||
$isBerechtigtNoStudstatusCheck = $this->permissionlib->isBerechtigt('student/keine_studstatuspruefung', null, 'suid');
|
||||
$isBerechtigtToDeleteAbgewiesen = $this->permissionlib->isBerechtigt('lehre/reihungstestAufsicht') && $status_kurzbz == "Abgewiesener";
|
||||
$isBerechtigtToDeleteAbgewiesen = $this->permissionlib->isBerechtigt('lehre/reihungstestAufsicht') && $status_kurzbz == Prestudentstatus_model::STATUS_ABGEWIESENER;
|
||||
|
||||
if(!$this->permissionlib->isBerechtigt('admin', 'suid', $stg) && !$this->permissionlib->isBerechtigt('assistenz', 'suid', $stg) && !$isBerechtigtToDeleteAbgewiesen)
|
||||
{
|
||||
return $this->terminateWithError($this->p->t('lehre','error_keineSchreibrechte'), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
|
||||
if($status_kurzbz=="Student" && !$isBerechtigtAdmin && !$isBerechtigtNoStudstatusCheck)
|
||||
if($status_kurzbz==Prestudentstatus_model::STATUS_STUDENT && !$isBerechtigtAdmin && !$isBerechtigtNoStudstatusCheck)
|
||||
{
|
||||
return $this->terminateWithError($this->p->t('lehre','error_onlyAdminDeleteRolleStudent'), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
@@ -713,7 +724,7 @@ class Status extends FHCAPI_Controller
|
||||
);
|
||||
if (isError($result) || !hasData($result))
|
||||
{
|
||||
//TODO(Manu) in this case: löschen stautus erlauben aber rückmeldung, dass Prestudent nicht gelöscht wurde
|
||||
//TODO(Manu) in this case: löschen status erlauben aber rückmeldung, dass Prestudent nicht gelöscht wurde
|
||||
return $this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
|
||||
@@ -801,13 +812,13 @@ class Status extends FHCAPI_Controller
|
||||
|
||||
$sqlundo =
|
||||
"
|
||||
INSERT INTO public.tbl_prestudent(prestudent_id, aufmerksamdurch_kurzbz, studiengang_kz, berufstaetigkeit_code, ausbildungcode,
|
||||
INSERT INTO public.tbl_prestudent(prestudent_id, aufmerksamdurch_kurzbz, studiengang_kz, berufstaetigkeit_code, ausbildungcode,
|
||||
zgv_code, zgvort, zgvdatum, zgvnation,zgv_erfuellt, zgvmas_code, zgvmaort, zgvmadatum, zgvmanation,zgvmas_erfuellt,
|
||||
aufnahmeschluessel, facheinschlberuf, anmeldungreihungstest, reihungstestangetreten, reihungstest_id,
|
||||
rt_gesamtpunkte, rt_punkte1, rt_punkte2, rt_punkte3, bismelden, person_id, anmerkung, mentor, ext_id,
|
||||
dual, ausstellungsstaat, zgvdoktor_code, zgvdoktorort, zgvdoktordatum, zgvdoktornation,
|
||||
gsstudientyp_kurzbz, aufnahmegruppe_kurzbz, priorisierung, zgvdoktor_erfuellt)
|
||||
VALUES('" . $prestudent_id . "',"
|
||||
VALUES('" . $prestudent_id . "',"
|
||||
. $quotes_aufmerksamdurch_kurzbz . $aufmerksamdurch_kurzbz . $quotes_aufmerksamdurch_kurzbz . ","
|
||||
. $quotes_studiengang_kz . $studiengang_kz . $quotes_studiengang_kz . ","
|
||||
. $quotes_berufstaetigkeit_code . $berufstaetigkeit_code . $quotes_berufstaetigkeit_code . ","
|
||||
@@ -846,7 +857,7 @@ class Status extends FHCAPI_Controller
|
||||
. $quotes_aufnahmegruppe_kurzbz . $aufnahmegruppe_kurzbz . $quotes_aufnahmegruppe_kurzbz . ","
|
||||
. $quotes_priorisierung . $priorisierung . $quotes_priorisierung . ","
|
||||
. $quotes_zgvdoktor_erfuellt . $zgvdoktor_erfuellt . $quotes_zgvdoktor_erfuellt . ");
|
||||
";
|
||||
";
|
||||
|
||||
$this->load->model('system/Log_model', 'LogModel');
|
||||
$result = $this->LogModel->insert([
|
||||
@@ -908,7 +919,6 @@ class Status extends FHCAPI_Controller
|
||||
}
|
||||
|
||||
$_POST = json_decode(utf8_encode($this->input->raw_input_stream), true);
|
||||
$this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel');
|
||||
|
||||
$uid = getAuthUID();
|
||||
$prestudent_id = $this->input->post('prestudent_id');
|
||||
@@ -927,23 +937,19 @@ class Status extends FHCAPI_Controller
|
||||
//check if Bismeldestichtag erreicht
|
||||
if(!$isBerechtigtNoStudstatusCheck)
|
||||
{
|
||||
$this->load->model('codex/Bismeldestichtag_model', 'BismeldestichtagModel');
|
||||
$result = $this->BismeldestichtagModel->checkIfMeldestichtagErreicht($datum);
|
||||
$result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($new_status_datum);
|
||||
return $this->terminateWithError("here2", self::ERROR_TYPE_GENERAL);
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
if ($result->retval == "1")
|
||||
{
|
||||
return $this->terminateWithError($this->p->t('lehre','error_dataVorMeldestichtag'), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
}
|
||||
|
||||
//check if Rolle already exists
|
||||
if(($key_studiensemester_kurzbz != $studiensemester_kurzbz)
|
||||
|| ($key_ausbildungssemester != $ausbildungssemester))
|
||||
{
|
||||
$result = $this->PrestudentstatusModel->checkIfExistingPrestudentRolle(
|
||||
$result = $this->prestudentstatuschecklib->checkIfExistingPrestudentRolle(
|
||||
$prestudent_id,
|
||||
$status_kurzbz,
|
||||
$studiensemester_kurzbz,
|
||||
@@ -951,33 +957,22 @@ class Status extends FHCAPI_Controller
|
||||
);
|
||||
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);
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
}
|
||||
|
||||
//check if studentrolle already exists
|
||||
if($status_kurzbz == 'Student' || $status_kurzbz == 'Diplomand')
|
||||
if($status_kurzbz == Prestudentstatus_model::STATUS_STUDENT || $status_kurzbz == Prestudentstatus_model::STATUS_DIPLOMAND )
|
||||
|
||||
//TODO(manu): check why $lastStatusDAta
|
||||
// if($status_kurzbz == Prestudentstatus_model::STATUS_STUDENT || $status_kurzbz == Prestudentstatus_model::STATUS_DIPLOMAND || $lastStatusData->status_kurzbz == Prestudentstatus_model::STATUS_STUDENT)
|
||||
{
|
||||
$this->load->model('crm/Student_model', 'StudentModel');
|
||||
$result = $this->StudentModel->checkIfExistingStudentRolle($prestudent_id);
|
||||
$result = $this->prestudentstatuschecklib->checkIfExistingStudentRolle($prestudent_id);
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
if($result->retval == "0")
|
||||
{
|
||||
return $this->terminateWithError($this->p->t('lehre','error_noStudstatus'), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
if($result->retval != "0")
|
||||
{
|
||||
$isStudent = true;
|
||||
}
|
||||
$isStudent = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1109,8 +1104,6 @@ class Status extends FHCAPI_Controller
|
||||
}
|
||||
|
||||
//Data Vorrücken
|
||||
$this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel');
|
||||
|
||||
$result = $this->PrestudentstatusModel->loadWhere(
|
||||
array(
|
||||
'prestudent_id' => $key_prestudent_id,
|
||||
@@ -1148,7 +1141,7 @@ class Status extends FHCAPI_Controller
|
||||
$ausbildungssem_next = $key_ausbildungssemester+1;
|
||||
|
||||
//check if Rolle already exists
|
||||
$result = $this->PrestudentstatusModel->checkIfExistingPrestudentRolle(
|
||||
$result = $this->prestudentstatuschecklib->checkIfExistingPrestudentRolle(
|
||||
$key_prestudent_id,
|
||||
$key_status_kurzbz,
|
||||
$studiensem_next,
|
||||
@@ -1158,24 +1151,28 @@ class Status extends FHCAPI_Controller
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
if($result->retval == '1')
|
||||
{
|
||||
return $this->terminateWithError($this->p->t('lehre','error_rolleBereitsVorhanden'), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
|
||||
//check if studentrolle already exists
|
||||
if($key_status_kurzbz == 'Student')
|
||||
// if($key_status_kurzbz == Prestudentstatus_model::STATUS_STUDENT)
|
||||
// {
|
||||
// $this->load->model('crm/Student_model', 'StudentModel');
|
||||
// $result = $this->StudentModel->checkIfExistingStudentRolle($key_prestudent_id);
|
||||
// if (isError($result))
|
||||
// {
|
||||
// return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
// }
|
||||
// if ($result->retval == "0")
|
||||
// {
|
||||
// return $this->terminateWithError($this->p->t('lehre','error_noStudstatus'), self::ERROR_TYPE_GENERAL);
|
||||
// }
|
||||
// }
|
||||
if($key_status_kurzbz == Prestudentstatus_model::STATUS_STUDENT || $key_status_kurzbz == Prestudentstatus_model::STATUS_DIPLOMAND || $lastStatusData->status_kurzbz == Prestudentstatus_model::STATUS_STUDENT)
|
||||
{
|
||||
$this->load->model('crm/Student_model', 'StudentModel');
|
||||
$result = $this->StudentModel->checkIfExistingStudentRolle($key_prestudent_id);
|
||||
$result = $this->prestudentstatuschecklib->checkIfExistingStudentRolle($key_prestudent_id);
|
||||
if (isError($result))
|
||||
{
|
||||
return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
if ($result->retval == "0")
|
||||
{
|
||||
return $this->terminateWithError($this->p->t('lehre','error_noStudstatus'), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
}
|
||||
|
||||
// Start DB transaction
|
||||
@@ -1276,8 +1273,6 @@ class Status extends FHCAPI_Controller
|
||||
return $this->terminateWithError($this->p->t('lehre','error_keineSchreibrechte'), self::ERROR_TYPE_GENERAL);
|
||||
}
|
||||
|
||||
$this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel');
|
||||
|
||||
$result = $this->PrestudentstatusModel->loadWhere(
|
||||
array(
|
||||
'prestudent_id' => $key_prestudent_id,
|
||||
|
||||
@@ -425,29 +425,30 @@ class PrestudentLib
|
||||
public function setStudent($prestudent_id, $studiensemester_kurzbz, $ausbildungssemester, $statusgrund_id, $bestaetigtAm, $bestaetigtVon)
|
||||
{
|
||||
$insertvon = getAuthUID();
|
||||
|
||||
$result = $this->_ci->PrestudentstatusModel->getLastStatus($prestudent_id, $studiensemester_kurzbz);
|
||||
|
||||
$result = $this->_ci->PrestudentstatusModel->getLastStatus($prestudent_id);
|
||||
if (isError($result))
|
||||
return $result;
|
||||
$result = getData($result);
|
||||
$resultStatus = getData($result);
|
||||
|
||||
//if not Wiederholer
|
||||
if($statusgrund_id != 16)
|
||||
{
|
||||
//check if ausbildungssemester is last
|
||||
$this->_ci->StudiengangModel->addJoin('public.tbl_prestudent p', 'studiengang_kz');
|
||||
$res = $this->_ci->StudiengangModel->loadWhere(['p.prestudent_id' => $prestudent_id]);
|
||||
if(isError($res))
|
||||
return $res;
|
||||
if(!hasData($res))
|
||||
$resultStg = $this->_ci->StudiengangModel->loadWhere(['p.prestudent_id' => $prestudent_id]);
|
||||
if(isError($resultStg))
|
||||
return $resultStg;
|
||||
if(!hasData($resultStg))
|
||||
return error($this->_ci->p->t('studierendenantrag', 'error_no_stg_for_prestudent', [
|
||||
'prestudent_id' => $prestudent_id
|
||||
]));
|
||||
|
||||
$studiengang = current(getData($res));
|
||||
$prestudent_status = current($result);
|
||||
|
||||
if(!$result)
|
||||
$studiengang = current(getData($resultStg));
|
||||
|
||||
$prestudent_status = ($resultStatus[0]);
|
||||
if(!$prestudent_status)
|
||||
{
|
||||
return error($this->_ci->p->t('studierendenantrag', 'error_no_prestudent_in_sem', [
|
||||
'prestudent_id' => $prestudent_id,
|
||||
@@ -456,7 +457,6 @@ class PrestudentLib
|
||||
}
|
||||
}
|
||||
|
||||
$prestudent_status = current($result);
|
||||
$result = $this->_ci->StudentModel->loadWhere(['prestudent_id' => $prestudent_id]);
|
||||
|
||||
if (isError($result))
|
||||
@@ -526,10 +526,13 @@ class PrestudentLib
|
||||
{
|
||||
$insertvon = getAuthUID();
|
||||
|
||||
$result = $this->_ci->PrestudentstatusModel->getLastStatus($prestudent_id, $studiensemester_kurzbz);
|
||||
$result = $this->_ci->PrestudentstatusModel->getLastStatus($prestudent_id);
|
||||
if (isError($result))
|
||||
return $result;
|
||||
$result = getData($result);
|
||||
if (!hasData($result))
|
||||
return error($this->_ci->p->t('studierendenantrag', 'error_no_student_for_prestudent', ['prestudent_id' => $prestudent_id]));
|
||||
|
||||
$result = getData($result) ?: [];
|
||||
|
||||
$prestudent_status = current($result);
|
||||
$result = $this->_ci->StudentModel->loadWhere(['prestudent_id' => $prestudent_id]);
|
||||
@@ -602,7 +605,7 @@ class PrestudentLib
|
||||
|
||||
public function setAbsolvent($prestudent_id, $studiensemester_kurzbz, $ausbildungssemester)
|
||||
{
|
||||
//TODO(Manu) makes no difference
|
||||
//TODO(Manu) why no lvb?
|
||||
/* if (gettype($ausbildungssemester) != "integer") {
|
||||
$ausbildungssemester = (int)$ausbildungssemester;
|
||||
}*/
|
||||
@@ -613,7 +616,7 @@ class PrestudentLib
|
||||
|
||||
$insertvon = getAuthUID();
|
||||
|
||||
$result = $this->_ci->PrestudentstatusModel->getLastStatus($prestudent_id, $studiensemester_kurzbz);
|
||||
$result = $this->_ci->PrestudentstatusModel->getLastStatus($prestudent_id);
|
||||
if (isError($result))
|
||||
return $result;
|
||||
$result = getData($result);
|
||||
@@ -627,7 +630,7 @@ class PrestudentLib
|
||||
if (!$result)
|
||||
return error($this->_ci->p->t('studierendenantrag', 'error_no_student_for_prestudent', ['prestudent_id' => $prestudent_id]));
|
||||
|
||||
// $student = current($result);
|
||||
$student = current($result);
|
||||
|
||||
//Status updaten
|
||||
$result = $this->_ci->PrestudentstatusModel->insert([
|
||||
|
||||
@@ -27,7 +27,10 @@ class PrestudentstatusCheckLib
|
||||
$this->_ci->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
|
||||
$this->_ci->load->model('person/Person_model', 'PersonModel');
|
||||
$this->_ci->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel');
|
||||
$this->_ci->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
$this->_ci->load->model('crm/Student_model', 'StudentModel');
|
||||
$this->_ci->load->model('organisation/Studienplan_model', 'StudienplanModel');
|
||||
$this->_ci->load->model('codex/Bismeldestichtag_model', 'BismeldestichtagModel');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,6 +96,174 @@ class PrestudentstatusCheckLib
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a prestudent role already exists.
|
||||
* @return error if invalid
|
||||
* @return 1 if role already exists, 0 if it does not
|
||||
*/
|
||||
public function checkIfExistingPrestudentRolle(
|
||||
$prestudent_id,
|
||||
$status_kurzbz,
|
||||
$tudiensemester_kurzbz,
|
||||
$ausbildungssemester
|
||||
)
|
||||
{
|
||||
$resultApp = $this->_getApplicationData($prestudent_id);
|
||||
if(isError($resultApp))
|
||||
{
|
||||
return getData($resultApp);
|
||||
}
|
||||
$resultApp = current(getData($resultApp));
|
||||
$studentName = trim ($resultApp->vorname.' '.$resultApp->nachname);
|
||||
|
||||
$result = $this->_ci->PrestudentstatusModel->checkIfExistingPrestudentRolle(
|
||||
$prestudent_id,
|
||||
$status_kurzbz,
|
||||
$tudiensemester_kurzbz,
|
||||
$ausbildungssemester
|
||||
);
|
||||
if(isError($result))
|
||||
{
|
||||
return getData($result);
|
||||
}
|
||||
$result = getData($result);
|
||||
|
||||
if($result == '1')
|
||||
{
|
||||
return error($studentName . ": " . $this->_ci->p->t('lehre', 'error_rolleBereitsVorhanden'));
|
||||
}
|
||||
return success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a student role already exists.
|
||||
* @return error if invalid
|
||||
* @return error, if role does not exist, else count(roles) if it does
|
||||
*/
|
||||
public function checkIfExistingStudentRolle($prestudent_id)
|
||||
{
|
||||
$resultApp = $this->_getApplicationData($prestudent_id);
|
||||
if(isError($resultApp))
|
||||
{
|
||||
return getData($resultApp);
|
||||
}
|
||||
$resultApp = current(getData($resultApp));
|
||||
$studentName = trim ($resultApp->vorname.' '.$resultApp->nachname);
|
||||
|
||||
$result = $this->_ci->StudentModel->checkIfExistingStudentRolle($prestudent_id);
|
||||
if(isError($result))
|
||||
{
|
||||
return getData($result);
|
||||
}
|
||||
$result = getData($result);
|
||||
|
||||
if($result == '0')
|
||||
{
|
||||
return error($this->_ci->p->t('lehre', 'error_noStudstatus', ['name' => $studentName]));
|
||||
}
|
||||
return success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Reihungstest was admitted
|
||||
* @param integer $prestudent_id
|
||||
* @return booleans $reihungstest_angetreten, error if not angetreten
|
||||
*/
|
||||
public function checkIfAngetreten($prestudent_id)
|
||||
{
|
||||
$result = $this->_getApplicationData($prestudent_id);
|
||||
if(isError($result))
|
||||
{
|
||||
return getData($result);
|
||||
}
|
||||
$result = current(getData($result));
|
||||
$studentName = trim ($result->vorname.' '.$result->nachname);
|
||||
|
||||
if (!$result->reihungstestangetreten)
|
||||
return error($this->_ci->p->t('lehre', 'error_keinReihungstestverfahren', ['name' => $studentName]));
|
||||
|
||||
return success($result->reihungstestangetreten);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if ZGV-Code is registered
|
||||
* @param integer $prestudent_id
|
||||
* @return booleans $zgv_code, error if not registered
|
||||
*/
|
||||
public function checkIfZGVEingetragen($prestudent_id, $typ=null)
|
||||
{
|
||||
$result = $this->_getApplicationData($prestudent_id);
|
||||
if(isError($result))
|
||||
{
|
||||
return getData($result);
|
||||
}
|
||||
$result = current(getData($result));
|
||||
$studentName = trim ($result->vorname.' '.$result->nachname);
|
||||
|
||||
if ($typ && $typ=='m' && !$result->zgvmas_code)
|
||||
{
|
||||
return error($this->_ci->p->t('lehre', 'error_ZGVMasterNichtEingetragen', ['name' => $studentName]));
|
||||
}
|
||||
else
|
||||
return success($result->zgvmas_code);
|
||||
|
||||
|
||||
if(!$result->zgv_code)
|
||||
{
|
||||
return error($this->_ci->p->t('lehre', 'error_ZGVNichtEingetragen', ['name' => $studentName]));
|
||||
}
|
||||
|
||||
return success($result->zgv_code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a bewerber status already exists.
|
||||
* @return error if invalid
|
||||
* @return error if no bewerberstatus, success otherwise
|
||||
*/
|
||||
public function checkIfExistingBewerberstatus($prestudent_id)
|
||||
{
|
||||
$result = $this->_getApplicationData($prestudent_id);
|
||||
if(isError($result))
|
||||
{
|
||||
return getData($result);
|
||||
}
|
||||
$result = current(getData($result));
|
||||
$studentName = trim ($result->vorname.' '.$result->nachname);
|
||||
|
||||
$result = $this->_ci->PrestudentstatusModel->checkIfExistingBewerberstatus(
|
||||
$prestudent_id
|
||||
);
|
||||
if(isError($result))
|
||||
{
|
||||
return getData($result);
|
||||
}
|
||||
if(getData($result) == "0")
|
||||
{
|
||||
return error($this->_ci->p->t('lehre','error_keinBewerber', ['name' => $studentName]));
|
||||
}
|
||||
return success(getData($result));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Bismeldestichtag erreicht
|
||||
* @param Date $statusDatum
|
||||
* @return error if Bismeldestichtag erreicht
|
||||
*/
|
||||
public function checkIfMeldestichtagErreicht($statusDatum, $studiensemester_kurzbz=null)
|
||||
{
|
||||
$result = $this->_ci->BismeldestichtagModel->checkIfMeldestichtagErreicht($statusDatum, $studiensemester_kurzbz);
|
||||
if(isError($result))
|
||||
{
|
||||
return getData($result);
|
||||
}
|
||||
if(getData($result) == "1")
|
||||
{
|
||||
return error($this->_ci->p->t('lehre','error_dataVorMeldestichtag'));
|
||||
}
|
||||
return success(getData($result));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if History of StatusData is valid
|
||||
* @param integer $prestudent_id
|
||||
@@ -298,4 +469,28 @@ class PrestudentstatusCheckLib
|
||||
|
||||
return $resultPs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Provides Application Data
|
||||
* @param integer $prestudent_id
|
||||
* @return error if not valid, array with ApplicationData if valid
|
||||
*/
|
||||
private function _getApplicationData($prestudent_id)
|
||||
{
|
||||
$this->_ci->PrestudentModel->addJoin('public.tbl_person p', 'ON (p.person_id = public.tbl_prestudent.person_id)');
|
||||
|
||||
$result = $this->_ci->PrestudentModel->load([
|
||||
'prestudent_id'=> $prestudent_id,
|
||||
]);
|
||||
if(isError($result))
|
||||
{
|
||||
return getData($result);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,10 @@ class Prestudentstatus_model extends DB_Model
|
||||
const STATUS_STUDENT = 'Student';
|
||||
const STATUS_DIPLOMAND = 'Diplomand';
|
||||
const STATUS_ABSOLVENT = 'Absolvent';
|
||||
const STATUS_BEWERBER = 'Bewerber';
|
||||
const STATUS_AUFGENOMMENER = 'Aufgenommener';
|
||||
const STATUS_WARTENDER = 'Wartender';
|
||||
const STATUS_ABGEWIESENER = 'Abgewiesener';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -397,8 +401,18 @@ class Prestudentstatus_model extends DB_Model
|
||||
* @param integer $prestudent_id
|
||||
* @return error if no bewerberstatus, success if existing
|
||||
*/
|
||||
public function checkIfExistingBewerberstatus($prestudent_id, $name = null)
|
||||
public function checkIfExistingBewerberstatus($prestudent_id)
|
||||
{
|
||||
$studentName = '';
|
||||
|
||||
$nameRes = $this->PersonModel->loadPrestudent($prestudent_id);
|
||||
|
||||
if (hasData($nameRes))
|
||||
{
|
||||
$nameData = getData($nameRes)[0];
|
||||
$studentName = $nameData->vorname.' '.$nameData->nachname;
|
||||
}
|
||||
|
||||
$qry = "SELECT
|
||||
*
|
||||
FROM
|
||||
@@ -416,8 +430,7 @@ class Prestudentstatus_model extends DB_Model
|
||||
}
|
||||
elseif (!hasData($result))
|
||||
{
|
||||
$person = $name ? $name : "Person";
|
||||
return success("0", $this->p->t('lehre','error_keinBewerber', ['name' => $person]));
|
||||
return success("0", $this->p->t('lehre','error_keinBewerber', ['name' => $studentName]));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -156,7 +156,7 @@ class Student_model extends DB_Model
|
||||
}
|
||||
else
|
||||
{
|
||||
return success("0", "Ein Studentenstatus kann hier nur hinzugefuegt werden wenn die Person bereits Student ist. Um einen Bewerber zum Studenten zu machen waehlen Sie bitte unter 'Status aendern' den Punkt 'Student'");
|
||||
return success("0");
|
||||
}
|
||||
} else {
|
||||
return error("StudentModel: Error During Check if Existing Student Rolle.");
|
||||
|
||||
@@ -942,7 +942,9 @@ export default{
|
||||
</div>
|
||||
<div v-else>
|
||||
<p>
|
||||
{{$p.t('lehre', 'modal_askAusbildungssemPlural', { count: prestudentIds.length })}}</p>
|
||||
{{$p.t('lehre', 'modal_askAusbildungssemPlural', { count: prestudentIds.length,
|
||||
status: actionStatusText
|
||||
})}}</p>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
|
||||
@@ -25943,13 +25943,33 @@ array(
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'In welches Semester sollen diese {count} PrestudentInnen verschoben werden?',
|
||||
'text' => 'In welches Semester sollen diese {count} PrestudentInnen ({status})verschoben werden?',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'To which education semester should these {count} prestudents be moved?',
|
||||
'text' => 'To which education semester should these {count} prestudents ({status}) be moved?',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'lehre',
|
||||
'phrase' => 'modal_askAusbildungssemPlural2',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'In welches Semester sollen diese {count} PrestudentInnen ({status}) verschoben werden?',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'To which education semester should these {count} prestudents ({status}) be moved?',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user