Compare commits

..
3 changed files with 79 additions and 4 deletions
@@ -865,6 +865,10 @@ class Abgabe extends FHCAPI_Controller
$existingPaabgabe = null;
if($paabgabe_id == -1) {
if(!$this->isAbgabetypAllowed($paabgabetyp_kurzbz, $studiengang_kz)) {
$this->terminateWithError($this->p->t('abgabetool', 'c4abgabetypNurAssistenz'));
}
$result = $this->PaabgabeModel->insert(
array(
'projektarbeit_id' => $projektarbeit_id,
@@ -910,6 +914,17 @@ class Abgabe extends FHCAPI_Controller
$this->terminateWithError($this->p->t('abgabetool', 'c4datumAendernNichtErlaubt'));
}
}
// betreuer may only change datum and abgabetyp of the abgabetypen they are allowed to create
$abgabetypChanged = $paabgabetyp_kurzbz !== $existingPaabgabe->paabgabetyp_kurzbz;
if(($datum !== $existingPaabgabe->datum || $abgabetypChanged)
&& !$this->isAbgabetypAllowed($existingPaabgabe->paabgabetyp_kurzbz, $studiengang_kz)) {
$this->terminateWithError($this->p->t('abgabetool', 'c4terminAendernNurAssistenz'));
}
if($abgabetypChanged && !$this->isAbgabetypAllowed($paabgabetyp_kurzbz, $studiengang_kz)) {
$this->terminateWithError($this->p->t('abgabetool', 'c4abgabetypNurAssistenz'));
}
$result = $this->PaabgabeModel->update(
$paabgabe_id,
@@ -1246,6 +1261,10 @@ class Abgabe extends FHCAPI_Controller
if(!$zugeordnet) {
$this->terminateWithError($this->p->t('abgabetool', 'c4noZuordnungBetreuerStudent', [getAuthUID(), $student_uid]), 'general');
}
if(!$this->isAbgabetypAllowed($paabgabetyp_kurzbz, $studiengang_kz)) {
$this->terminateWithError($this->p->t('abgabetool', 'c4abgabetypNurAssistenz'));
}
$result = $this->PaabgabeModel->insert(
array(
@@ -1984,6 +2003,12 @@ class Abgabe extends FHCAPI_Controller
return $this->checkZuordnung($projektarbeit_id, $auth_uid, $student_uid, $studiengang_kz);
}
// betreuer may only use the abgabetypen in ALLOWED_ABGABETYPEN_BETREUER, assistenz may use all
private function isAbgabetypAllowed($paabgabetyp_kurzbz, $studiengang_kz) {
return in_array($paabgabetyp_kurzbz, $this->config->item('ALLOWED_ABGABETYPEN_BETREUER'))
|| $this->permissionlib->isBerechtigt('basis/abgabe_assistenz', 'suid', $studiengang_kz);
}
// loads a projektarbeit table row by id and looks if a note has been set. A non null note field
// currently indicates that a projektarbeit has been finished and should not accept further crud manipulation
private function checkProjektarbeitForFinishedStatus($projektarbeit_id) {
@@ -94,6 +94,10 @@ export const AbgabeMitarbeiterDetail = {
terminIsInvalid(termin) {
return termin.note?.positiv == false && !termin.beurteilungsnotiz
},
terminIsLocked(termin) {
// betreuer may only change datum and abgabetyp of the abgabetypen they are allowed to create
return !this.assistenzMode && !this.abgabetypenBetreuer.includes(termin.paabgabetyp_kurzbz)
},
getNoteBezeichnung(termin){
if(termin.noteBackend?.bezeichnung) {
return termin.noteBackend?.positiv ? this.$capitalize(this.$p.t('abgabetool/c4positivBenotet')) + ' ✅' : this.$capitalize(this.$p.t('abgabetool/c4negativBenotet')) + ' ❌'
@@ -573,6 +577,12 @@ export const AbgabeMitarbeiterDetail = {
class: "custom-tooltip"
}
},
getTooltipTerminNurAssistenz() {
return {
value: this.$p.t('abgabetool/c4terminAendernNurAssistenz'),
class: "custom-tooltip"
}
},
getProjektarbeitTitel() {
if(this.projektarbeit?.titel) return this.$capitalize(this.$p.t('abgabetool/c4titel')) + ': ' + this.projektarbeit.titel
@@ -812,11 +822,11 @@ export const AbgabeMitarbeiterDetail = {
<div class="row fw-bold" style="margin-left: 2px">{{$capitalize( $p.t('abgabetool/c4zieldatumv2') )}}</div>
<div class="row fw-light" style="margin-left: 2px">{{$capitalize( $p.t('abgabetool/c4abgabeuntil2359') )}}</div>
</div>
<div class="col-12 col-md-9">
<div class="col-12 col-md-9" v-tooltip.right="terminIsLocked(termin) && getTooltipTerminNurAssistenz">
<VueDatePicker
v-model="termin.datum"
:clearable="false"
:disabled="!termin.allowedToSave"
:disabled="!termin.allowedToSave || terminIsLocked(termin)"
:enable-time-picker="false"
locale="de"
format="dd.MM.yyyy"
@@ -828,10 +838,10 @@ export const AbgabeMitarbeiterDetail = {
</div>
<div class="row mt-2">
<div class="col-12 col-md-3 fw-bold align-content-center">{{$capitalize( $p.t('abgabetool/c4abgabetyp') )}}</div>
<div class="col-12 col-md-9">
<div class="col-12 col-md-9" v-tooltip.right="terminIsLocked(termin) && getTooltipTerminNurAssistenz">
<Dropdown
:style="{'width': '100%'}"
:disabled="!termin.allowedToSave || termin.abgabedatum !== null || termin.noteBackend"
:disabled="!termin.allowedToSave || termin.abgabedatum !== null || termin.noteBackend || terminIsLocked(termin)"
:placeholder="getPlaceholderTermin(termin)"
v-model="termin.bezeichnung"
@change="handleChangeAbgabetyp(termin)"
+40
View File
@@ -49372,6 +49372,46 @@ In the list:
)
)
),
array(
'app' => 'core',
'category' => 'abgabetool',
'phrase' => 'c4terminAendernNurAssistenz',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Zieldatum und Abgabetyp dieses Termins darf nur die Studiengangsassistenz ändern.',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Only the program assistant may change the deadline and the submission type of this appointment.',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'abgabetool',
'phrase' => 'c4abgabetypNurAssistenz',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Diesen Abgabetyp darf nur die Studiengangsassistenz vergeben.',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Only the program assistant may assign this submission type.',
'description' => '',
'insertvon' => 'system'
)
)
),
// ABGABETOOL PHRASEN END
array(
'app' => 'core',