mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-16 22:42:16 +00:00
Delete Prestudent
This commit is contained in:
@@ -111,7 +111,14 @@ class Status extends FHC_Controller
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson(getError($result));
|
||||
}
|
||||
$lastStatusData = current(getData($result));
|
||||
elseif(!hasData($result))
|
||||
{
|
||||
$lastStatusData = [];
|
||||
/* $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson("donn holt nittan");*/
|
||||
}
|
||||
else
|
||||
$lastStatusData = current(getData($result));
|
||||
//var_dump($lastStatusData);
|
||||
|
||||
//Different handling depending on newStatus
|
||||
@@ -214,7 +221,7 @@ class Status extends FHC_Controller
|
||||
}
|
||||
}
|
||||
|
||||
//TODO(Manu) permission not working here...
|
||||
//TODO(Manu) check permission...
|
||||
$hasPermissionToSkipStatusCheck = $this->permissionlib->isBerechtigt('student/keine_studdatuspruefung');
|
||||
/* var_dump($hasPermissionToSkipStatusCheck);
|
||||
|
||||
@@ -309,8 +316,9 @@ class Status extends FHC_Controller
|
||||
$status_kurzbz = $this->input->post('status_kurzbz');
|
||||
$ausbildungssemester = $this->input->post('ausbildungssemester');
|
||||
$studiensemester_kurzbz = $this->input->post('studiensemester_kurzbz');
|
||||
$deletePrestudent = false;
|
||||
|
||||
//TODO(Manu) check: warum sind beim Löschen andere Berechtigungen?
|
||||
//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');
|
||||
@@ -346,22 +354,28 @@ class Status extends FHC_Controller
|
||||
}
|
||||
|
||||
|
||||
if(!$isBerechtigtAdmin && !$isBerechtigtNoStudstatusCheck)
|
||||
//check if last status
|
||||
$result = $this->PrestudentstatusModel->checkIfLastStatusEntry($prestudent_id);
|
||||
if (isError($result))
|
||||
{
|
||||
//check if last status
|
||||
$result = $this->PrestudentstatusModel->checkIfLastStatusEntry($prestudent_id);
|
||||
if (isError($result))
|
||||
{
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson($result);
|
||||
}
|
||||
if($result->retval == "1")
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson($result);
|
||||
}
|
||||
if($result->retval == "1")
|
||||
{
|
||||
//Berechtigungen nach Check prüfen!
|
||||
if(!$isBerechtigtAdmin && !$isBerechtigtNoStudstatusCheck)
|
||||
{
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson($result->code);
|
||||
}
|
||||
else
|
||||
{
|
||||
$deletePrestudent = true;
|
||||
}
|
||||
}
|
||||
|
||||
//TODO(manu) $this->db->trans_start(false); and rollback?
|
||||
//Delete Status
|
||||
$result = $this->PrestudentstatusModel->delete(
|
||||
array(
|
||||
@@ -376,29 +390,31 @@ class Status extends FHC_Controller
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
$this->outputJson($result);
|
||||
}
|
||||
elseif(!hasData($result)) {
|
||||
if(!hasData($result)) {
|
||||
$this->outputJson($result);
|
||||
}
|
||||
//return $this->outputJsonSuccess(current(getData($result)));
|
||||
|
||||
// Delete Studentlehrverband if no Status left
|
||||
//Delete Studentlehrverband if no Status left
|
||||
$result = $this->PrestudentstatusModel->getLastStatus($prestudent_id, $studiensemester_kurzbz);
|
||||
|
||||
if(isError($result))
|
||||
{
|
||||
if (isError($result)) {
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson(getError($result));
|
||||
}
|
||||
if(!hasData($result))
|
||||
if (!hasData($result))
|
||||
{
|
||||
//get student_uid
|
||||
$this->load->model('crm/Student_model', 'StudentModel');
|
||||
$result = $this->StudentModel->checkIfUid($prestudent_id);
|
||||
if(isError($result))
|
||||
if (isError($result))
|
||||
{
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson(getError($result));
|
||||
}
|
||||
if (!hasData($result))
|
||||
{
|
||||
$this->outputJson($result);
|
||||
}
|
||||
$student_uid = $result->retval;
|
||||
|
||||
$this->load->model('education/Studentlehrverband_model', 'StudentlehrverbandModel');
|
||||
@@ -413,16 +429,42 @@ class Status extends FHC_Controller
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
$this->outputJson("Fehler beim Löschen der Lehrverbandszuordnung");
|
||||
}
|
||||
if(!hasData($result)) {
|
||||
if (!hasData($result))
|
||||
{
|
||||
$this->outputJson($result);
|
||||
var_dump("no data2");
|
||||
}
|
||||
$this->outputJsonSuccess(true);
|
||||
|
||||
}
|
||||
|
||||
//Delete Prestudent if no data is left
|
||||
if($deletePrestudent)
|
||||
{
|
||||
//TODO(manu) check all connected tables and delete them
|
||||
//es wird noch auf prestudent_dokumentprestudent verwiesen
|
||||
//löschen zuerst von Doks
|
||||
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
$result = $this->PrestudentModel->delete(
|
||||
array(
|
||||
'prestudent_id' => $prestudent_id
|
||||
)
|
||||
);
|
||||
if (isError($result))
|
||||
{
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
$this->outputJson($result);
|
||||
}
|
||||
return $this->outputJsonSuccess(true);
|
||||
if(!hasData($result))
|
||||
{
|
||||
$this->outputJson($result);
|
||||
}
|
||||
$this->outputJson($result);
|
||||
|
||||
|
||||
}
|
||||
//TODO(manu) $this->db->trans_start(false); and rollback?
|
||||
//TODO(manu) ganzen Prestudenten löschen, wenn kein Eintrag mehr
|
||||
|
||||
return $this->outputJsonSuccess(true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function updateStatus($key_prestudent_id, $key_status_kurzbz, $key_studiensemester_kurzbz, $key_ausbildungssemester)
|
||||
@@ -498,7 +540,7 @@ class Status extends FHC_Controller
|
||||
}
|
||||
}
|
||||
|
||||
//TODO(Manu) permission not working here...
|
||||
//TODO(Manu) check permissions
|
||||
$hasPermissionToSkipStatusCheck = $this->permissionlib->isBerechtigt('student/keine_studdatuspruefung');
|
||||
/* var_dump($hasPermissionToSkipStatusCheck);
|
||||
|
||||
|
||||
@@ -743,7 +743,7 @@ class Prestudent_model extends DB_Model
|
||||
{
|
||||
return getData($result);
|
||||
}
|
||||
if($result->retval != "0")
|
||||
if($result->retval == "0") //wenn kein studentlehrband eingetragen
|
||||
{
|
||||
$query = "
|
||||
SELECT
|
||||
@@ -782,7 +782,7 @@ class Prestudent_model extends DB_Model
|
||||
{
|
||||
$query = "
|
||||
SELECT
|
||||
ps.status_kurzbz2,
|
||||
ps.status_kurzbz,
|
||||
ps.studiensemester_kurzbz,
|
||||
ps.ausbildungssemester,
|
||||
CASE WHEN ps.status_kurzbz IN ('Student', 'Diplomand') THEN CONCAT(lv.semester, lv.verband, lv.gruppe) END AS lehrverband,
|
||||
|
||||
@@ -504,13 +504,19 @@ class Prestudentstatus_model extends DB_Model
|
||||
$new_status_semesterstart = $studiensemester->start;
|
||||
|
||||
//get all prestudentstati
|
||||
//TODO(manu) errorlogic
|
||||
$resultPs = $this->getAllPrestudentstatiWithStudiensemester($prestudent_id);
|
||||
if (isError($resultPs))
|
||||
{
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
return $this->outputJson(getError($resultPs));
|
||||
$resultArr = [];
|
||||
}
|
||||
$resultArr = $resultPs->retval;
|
||||
if(!hasData($resultPs))
|
||||
{
|
||||
$resultArr = [];
|
||||
}
|
||||
else
|
||||
$resultArr = $resultPs->retval;
|
||||
|
||||
$statusArr = array();
|
||||
|
||||
$newStatusInserted = false;
|
||||
@@ -625,7 +631,7 @@ class Prestudentstatus_model extends DB_Model
|
||||
return error($result);
|
||||
}
|
||||
if (!hasData($result)) {
|
||||
return error('No Statusdata vorhanden');
|
||||
return success("0",'No Statusdata vorhanden');
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
||||
@@ -82,7 +82,7 @@ class Student_model extends DB_Model
|
||||
|
||||
if(isError($result))
|
||||
{
|
||||
return error("0", "Error while checking student_uid");
|
||||
return error( "Error while checking student_uid");
|
||||
}
|
||||
|
||||
if (!hasData($result))
|
||||
|
||||
@@ -198,6 +198,7 @@ export default {
|
||||
<div class="stv-details-details h-100 pb-3">
|
||||
<form-form ref="form" class="stv-details-prestudent" @submit.prevent="updatePrestudent">
|
||||
<div class="position-sticky top-0 z-1">
|
||||
<!--TODO(manu) Button inactiv setzen, wenn keine Änderungen-->
|
||||
<button type="submit" class="btn btn-primary position-absolute top-0 end-0" >Speichern</button>
|
||||
</div>
|
||||
<!--<form ref="form">-->
|
||||
|
||||
@@ -200,11 +200,13 @@ export default{
|
||||
actionConfirmStatus(status, stdsem, ausbildungssemester){
|
||||
console.log("Action: Status bestätigen: (" + status + ": " + stdsem + "/" + ausbildungssemester + ")")
|
||||
//this.$refs.deleteStatusModal.show();
|
||||
|
||||
/* this.loadStatus(status_id).then(() => {
|
||||
if(this.statusData.bankverbindung_id)
|
||||
this.$refs.deleteStatusModal.show();
|
||||
});*/
|
||||
this.statusId = {
|
||||
'prestudent_id': this.prestudent_id,
|
||||
'status_kurzbz': status,
|
||||
'studiensemester_kurzbz': stdsem,
|
||||
'ausbildungssemester': ausbildungssemester
|
||||
};
|
||||
console.log(this.statusId);
|
||||
},
|
||||
addNewStatus(){
|
||||
CoreRESTClient.post('components/stv/Status/addNewStatus/' + this.prestudent_id,
|
||||
@@ -590,7 +592,7 @@ export default{
|
||||
type="select"
|
||||
name="studiensemester_kurzbz"
|
||||
v-model="statusData['studiensemester_kurzbz']"
|
||||
> <!--TODO(manu) default aktueller Eintrag-->
|
||||
>
|
||||
<option v-for="sem in listStudiensemester" :key="sem.studiensemester_kurzbz" :value="sem.studiensemester_kurzbz">{{sem.studiensemester_kurzbz}}</option>
|
||||
</form-input>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user