mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-01 19:09:27 +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); ?>
|
||||
|
||||
@@ -71,11 +71,11 @@ export default {
|
||||
}
|
||||
};
|
||||
},
|
||||
deleteProjektarbeitAbgabe(paabgabe_id, projektarbeit_id) {
|
||||
deleteProjektarbeitAbgabe(paabgabe_id) {
|
||||
return {
|
||||
method: 'post',
|
||||
url: '/api/frontend/v1/Abgabe/deleteProjektarbeitAbgabe',
|
||||
params: { paabgabe_id, projektarbeit_id }
|
||||
params: { paabgabe_id }
|
||||
};
|
||||
},
|
||||
postSerientermin(datum, paabgabetyp_kurzbz, bezeichnung, kurzbz, upload_allowed, projektarbeit_ids, fixtermin) {
|
||||
|
||||
@@ -29,7 +29,7 @@ const app = Vue.createApp({
|
||||
return { uid: this.uid}
|
||||
},
|
||||
student_uid_computed() {
|
||||
return this.student_uid ?? null
|
||||
return this.student_uid ?? this.uid
|
||||
},
|
||||
stg_kz_computed() {
|
||||
return this.stg_kz ?? null
|
||||
|
||||
@@ -40,7 +40,6 @@ export const AbgabeMitarbeiterDetail = {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
activeIndexArray: null,
|
||||
showAutomagicModalPhrase: false,
|
||||
eidAkzeptiert: false,
|
||||
enduploadTermin: null,
|
||||
@@ -79,25 +78,6 @@ export const AbgabeMitarbeiterDetail = {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getActiveIndexTabArray(additional = []) {
|
||||
// here we try to assume which abgabetermine are the most relevant to the current user
|
||||
|
||||
// lets try to take the termin with nearest date
|
||||
let closestIndex = -1;
|
||||
let minDiff = Infinity;
|
||||
const today = new Date();
|
||||
|
||||
|
||||
this.projektarbeit.abgabetermine.forEach((obj, i) => {
|
||||
const diff = Math.abs(new Date(obj.datum) - today);
|
||||
if (diff < minDiff) {
|
||||
minDiff = diff;
|
||||
closestIndex = i;
|
||||
}
|
||||
});
|
||||
|
||||
return [closestIndex, ...additional]
|
||||
},
|
||||
getPlaceholderTermin(termin) {
|
||||
return termin?.bezeichnung ? this.$p.t('abgabetool/c4paatyp' + termin.paabgabetyp_kurzbz) : this.$p.t('abgabetool/abgabetypPlaceholder')
|
||||
},
|
||||
@@ -143,7 +123,6 @@ export const AbgabeMitarbeiterDetail = {
|
||||
this.projektarbeit.abgabetermine.sort((a, b) =>new Date(a.datum) - new Date(b.datum))
|
||||
|
||||
const index = this.projektarbeit.abgabetermine.findIndex(t => termin.paabgabe_id == t.paabgabe_id)
|
||||
this.activeIndexArray = this.getActiveIndexTabArray([index])
|
||||
|
||||
// negative abgabe -> automagically open new termin modal
|
||||
// really bad feature imo that will be annoying to deal with
|
||||
@@ -255,7 +234,7 @@ export const AbgabeMitarbeiterDetail = {
|
||||
}
|
||||
},
|
||||
deleteTermin(termin) {
|
||||
this.$api.call(ApiAbgabe.deleteProjektarbeitAbgabe(termin.paabgabe_id, this.projektarbeit.projektarbeit_id)).then( (res) => {
|
||||
this.$api.call(ApiAbgabe.deleteProjektarbeitAbgabe(termin.paabgabe_id)).then( (res) => {
|
||||
if(res?.meta?.status == 'success') {
|
||||
this.$fhcAlert.alertSuccess(this.$p.t('ui/genericDeleted', [this.$p.t('abgabetool/abgabe')]))
|
||||
// this.$p.t('global/tooltipLektorDeleteKontrolle', [this.$entryParams.permissions.kontrolleDeleteMaxReach ])
|
||||
@@ -372,7 +351,7 @@ export const AbgabeMitarbeiterDetail = {
|
||||
window.open(link, '_blank')
|
||||
} else if(this.projektarbeit?.abgabetermine.find(termin => termin.paabgabetyp_kurzbz == 'end' && termin.abgabedatum !== null) && this.projektarbeit?.beurteilungLinkOld) {
|
||||
if(await this.$fhcAlert.confirm({
|
||||
message: this.$p.t('abgabetool/c4aeltereParbeitBenoten'),
|
||||
message: this.$p.t('abgabetool/c4aeltereParbeitBenotenv2'),
|
||||
acceptLabel: this.$capitalize(this.$p.t('abgabetool/c4AcceptAndProceed')),
|
||||
acceptClass: 'btn btn-danger',
|
||||
rejectLabel: this.$capitalize(this.$p.t('abgabetool/c4Cancel')),
|
||||
@@ -610,8 +589,6 @@ export const AbgabeMitarbeiterDetail = {
|
||||
'projektarbeit'(newVal) {
|
||||
// set invertedFixtermin field for UI/UX purposes -> avoid double negation in text
|
||||
|
||||
this.activeIndexArray = this.getActiveIndexTabArray()
|
||||
|
||||
newVal?.abgabetermine?.forEach(termin => termin.invertedFixtermin = !termin.fixtermin)
|
||||
|
||||
// default select german if projektarbeit sprache was null
|
||||
@@ -748,7 +725,7 @@ export const AbgabeMitarbeiterDetail = {
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<Accordion :multiple="true" :activeIndex="activeIndexArray">
|
||||
<Accordion :multiple="true">
|
||||
<template v-for="termin in this.projektarbeit?.abgabetermine">
|
||||
<AccordionTab :headerClass="getDateStyleClass(termin) + '-header'">
|
||||
<template #header>
|
||||
@@ -880,7 +857,7 @@ export const AbgabeMitarbeiterDetail = {
|
||||
<Message v-else-if="termin?.signatur == 'error'" severity="warn" :closable="false" :pt="getMessagePtStyle"> {{ $capitalize($p.t('abgabetool/c4signaturServerError')) }} </Message>
|
||||
</div>
|
||||
<div v-else class="col-auto">
|
||||
<Message severity="info" :closable="false" :pt="getMessagePtStyle"> {{ $p.t('abgabetool/c4noFileFound') }} </Message>
|
||||
<Message severity="info" :closable="false" :pt="getMessagePtStyle"> {{ $p.t('abgabetool/c4noSignatureCheckPossible') }} </Message>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -211,24 +211,6 @@ export const AbgabeStudentDetail = {
|
||||
}
|
||||
}
|
||||
},
|
||||
getActiveIndexTabArray() {
|
||||
// here we try to do mind reading logic by assuming which abgabetermine are the most relevant to the current user
|
||||
|
||||
// lets try to take the termin with nearest date and watch who complains and why
|
||||
let closestIndex = -1;
|
||||
let minDiff = Infinity;
|
||||
const today = new Date();
|
||||
|
||||
this.projektarbeit.abgabetermine.forEach((obj, i) => {
|
||||
const diff = Math.abs(new Date(obj.datum) - today);
|
||||
if (diff < minDiff) {
|
||||
minDiff = diff;
|
||||
closestIndex = i;
|
||||
}
|
||||
});
|
||||
|
||||
return [closestIndex]
|
||||
},
|
||||
getEid() {
|
||||
return this.$capitalize(this.$p.t('abgabetool/c4eidesstattlicheErklaerung'))
|
||||
},
|
||||
@@ -327,7 +309,7 @@ export const AbgabeStudentDetail = {
|
||||
<p> {{projektarbeit?.titel}}</p>
|
||||
</div>
|
||||
|
||||
<Accordion :multiple="true" :activeIndex="getActiveIndexTabArray">
|
||||
<Accordion :multiple="true">
|
||||
<template v-for="termin in this.projektarbeit?.abgabetermine">
|
||||
<AccordionTab :headerClass="termin.dateStyle + '-header'">
|
||||
<template #header>
|
||||
|
||||
@@ -153,7 +153,7 @@ export const AbgabetoolStudent = {
|
||||
|
||||
// development purposes
|
||||
// termin.allowedToUpload = this.checkQualityGatesStrict(pa.abgabetermine)
|
||||
termin.allowedToUpload = true
|
||||
// termin.allowedToUpload = true
|
||||
|
||||
} else if(termin.fixtermin) {
|
||||
termin.allowedToUpload = !this.isPastDate(termin.datum)
|
||||
|
||||
@@ -43719,7 +43719,7 @@ array(
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'abgabetool',
|
||||
'phrase' => 'c4aeltereParbeitBenoten',
|
||||
'phrase' => 'c4aeltereParbeitBenotenv2',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
@@ -43736,6 +43736,26 @@ array(
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'abgabetool',
|
||||
'phrase' => 'c4noSignatureCheckPossible',
|
||||
'insertvon' => 'system',
|
||||
'phrases' => array(
|
||||
array(
|
||||
'sprache' => 'German',
|
||||
'text' => 'Signatur konnte nicht überprüft werden',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
),
|
||||
array(
|
||||
'sprache' => 'English',
|
||||
'text' => 'Unable to check signature',
|
||||
'description' => '',
|
||||
'insertvon' => 'system'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'app' => 'core',
|
||||
'category' => 'abgabetool',
|
||||
|
||||
Reference in New Issue
Block a user