mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-23 01:42:17 +00:00
finetuning
This commit is contained in:
@@ -592,41 +592,32 @@ class Abgabe extends FHCAPI_Controller
|
||||
*/
|
||||
public function deleteProjektarbeitAbgabe() {
|
||||
$paabgabe_id = $this->input->post('paabgabe_id');
|
||||
$projektarbeit_id = $this->input->post('projektarbeit_id');
|
||||
|
||||
if ($paabgabe_id === NULL || trim((string)$paabgabe_id) === ''
|
||||
|| $projektarbeit_id === NULL || trim((string)$projektarbeit_id) === '') {
|
||||
if ($paabgabe_id === NULL || trim((string)$paabgabe_id) === '') {
|
||||
$this->terminateWithError($this->p->t('global', 'wrongParameters'), 'general');
|
||||
}
|
||||
|
||||
$zugeordnet = $this->checkZuordnung($projektarbeit_id, getAuthUID());
|
||||
$zugeordnet = $this->checkZuordnungByPaabgabe($paabgabe_id, getAuthUID());
|
||||
|
||||
if(!$zugeordnet) {
|
||||
$this->terminateWithError($this->p->t('abgabetool', 'c4noZuordnungBetreuerStudent'));
|
||||
}
|
||||
|
||||
// TODO: check zuordnung paabgabe_id / projektarbeit_id
|
||||
|
||||
$this->load->model('education/Paabgabe_model', 'PaabgabeModel');
|
||||
|
||||
$this->load->model('education/Paabgabe_model', 'PaabgabeModel');
|
||||
|
||||
$paabgabeResult = $this->PaabgabeModel->load($paabgabe_id);
|
||||
$paabgabeArr = $this->getDataOrTerminateWithError($paabgabeResult);
|
||||
|
||||
if(count($paabgabeArr) == 0)
|
||||
if(count($paabgabeArr) == 0) {
|
||||
$this->terminateWithError($this->p->t('global', 'wrongParameters'), 'general');
|
||||
|
||||
// TODO: diese prüfung entfernen
|
||||
if($paabgabeArr[0]->insertvon === getAuthUID()) {
|
||||
$result = $this->PaabgabeModel->delete($paabgabe_id);
|
||||
$result = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
// TODO: consider this in nightly email job
|
||||
|
||||
$this->logLib->logInfoDB(array($paabgabeArr[0], getAuthUID(), getAuthPersonId()));
|
||||
$this->terminateWithSuccess($result);
|
||||
}
|
||||
|
||||
$result = $this->PaabgabeModel->delete($paabgabe_id);
|
||||
$result = $this->getDataOrTerminateWithError($result);
|
||||
|
||||
$this->terminateWithError($this->p->t('global', 'wrongParameters'), 'general');
|
||||
// TODO: consider this in nightly email job
|
||||
$this->logLib->logInfoDB(array($paabgabeArr[0], getAuthUID(), getAuthPersonId()));
|
||||
$this->terminateWithSuccess($result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -660,7 +651,6 @@ class Abgabe extends FHCAPI_Controller
|
||||
|
||||
// old script afterwards again queries if user is not the zweitbetreuer of any id - this is blocked in the ui
|
||||
// and should never unintentionally happen
|
||||
|
||||
$this->load->model('education/Paabgabe_model', 'PaabgabeModel');
|
||||
$this->load->model('education/Projektarbeit_model', 'ProjektarbeitModel');
|
||||
|
||||
@@ -746,7 +736,8 @@ class Abgabe extends FHCAPI_Controller
|
||||
|
||||
//TODO: check if private mail exists, if not take uid@domain
|
||||
|
||||
return $email[0]->private_email;
|
||||
return $email[0]->private_email ?? $email[0]->uid.'@'.DOMAIN;
|
||||
|
||||
}
|
||||
|
||||
//TODO: SWITCH TO NOTEN API ONCE NOTENTOOL IS IN MASTER TO AVOID DUPLICATE API
|
||||
@@ -1002,7 +993,7 @@ class Abgabe extends FHCAPI_Controller
|
||||
if($abgabe->paabgabetyp_kurzbz != 'end') {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$path = PAABGABE_PATH.$abgabe->paabgabe_id.'_'.$projektarbeit->student_uid.'.pdf';
|
||||
|
||||
$signaturVorhanden = null; // if frontend receives null -> indicates no file found at path
|
||||
@@ -1223,5 +1214,21 @@ class Abgabe extends FHCAPI_Controller
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function checkZuordnungByPaabgabe($paabgabe_id, $betreuer_uid) {
|
||||
$this->load->model('education/Projektarbeit_model', 'ProjektarbeitModel');
|
||||
$res = $this->ProjektarbeitModel->getProjektarbeitByPaabgabeID($paabgabe_id);
|
||||
if(isError($res)) {
|
||||
$this->terminateWithError($this->p->t('abgabetool', 'c4errorLoadingProjektarbeitForPaabgabeID'));
|
||||
}
|
||||
|
||||
if(!hasData($res)) {
|
||||
$this->terminateWithError($this->p->t('abgabetool', 'c4noAssignedProjektarbeitForPaabgabeID'));
|
||||
}
|
||||
$data = getData($res)[0];
|
||||
$projektarbeit_id = $data->projektarbeit_id;
|
||||
|
||||
return $this->checkZuordnung($projektarbeit_id, $betreuer_uid);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -233,7 +233,7 @@ class Projektarbeit_model extends DB_Model
|
||||
CASE WHEN zustellung THEN 0 ELSE 1 END,
|
||||
insertamum DESC NULLS LAST
|
||||
LIMIT 1
|
||||
) AS private_email
|
||||
) AS private_email, mitarbeiter_uid as uid
|
||||
FROM lehre.tbl_projektarbeit pa
|
||||
JOIN lehre.tbl_projektbetreuer USING (projektarbeit_id)
|
||||
JOIN public.tbl_person pers USING (person_id)
|
||||
@@ -463,4 +463,17 @@ class Projektarbeit_model extends DB_Model
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getProjektarbeitByPaabgabeID($paabgabe_id) {
|
||||
$qry = "SELECT
|
||||
projektarbeit_id
|
||||
FROM
|
||||
campus.tbl_paabgabe
|
||||
JOIN lehre.tbl_projektarbeit USING(projektarbeit_id)
|
||||
WHERE
|
||||
campus.tbl_paabgabe.paabgabe_id = ?;
|
||||
";
|
||||
|
||||
return $this->execReadOnlyQuery($qry, [$paabgabe_id]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,9 +38,9 @@ $includesArray = array(
|
||||
$this->load->view('templates/FHC-Header', $includesArray);
|
||||
?>
|
||||
<div id="abgabetoolroot" class="h-100" style="max-width: 95%;" route=<?php echo json_encode($route) ?>
|
||||
uid=<?php echo $uid ?> student_uid_prop=<?php echo $student_uid_prop ?? '""' ?>
|
||||
stg_kz_prop=<?php echo $stg_kz_prop ?? '""' ?>
|
||||
uid=<?php echo $uid ?>
|
||||
student_uid_prop="<?php echo $student_uid_prop ?? '' ?>"
|
||||
stg_kz_prop="<?php echo $stg_kz_prop ?? '' ?>"
|
||||
>
|
||||
|
||||
</div>
|
||||
<?php $this->load->view('templates/FHC-Footer', $includesArray); ?>
|
||||
|
||||
Reference in New Issue
Block a user