diff --git a/application/controllers/api/frontend/v1/Abgabe.php b/application/controllers/api/frontend/v1/Abgabe.php
index dc859f605..847df2c12 100644
--- a/application/controllers/api/frontend/v1/Abgabe.php
+++ b/application/controllers/api/frontend/v1/Abgabe.php
@@ -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);
+ }
}
\ No newline at end of file
diff --git a/application/models/education/Projektarbeit_model.php b/application/models/education/Projektarbeit_model.php
index ea16b5587..e9208e51d 100644
--- a/application/models/education/Projektarbeit_model.php
+++ b/application/models/education/Projektarbeit_model.php
@@ -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]);
+ }
}
diff --git a/application/views/Cis/Abgabetool.php b/application/views/Cis/Abgabetool.php
index 416f626e6..480116290 100644
--- a/application/views/Cis/Abgabetool.php
+++ b/application/views/Cis/Abgabetool.php
@@ -38,9 +38,9 @@ $includesArray = array(
$this->load->view('templates/FHC-Header', $includesArray);
?>
- uid= student_uid_prop=
- stg_kz_prop=
+ uid=
+ student_uid_prop=""
+ stg_kz_prop=""
>
-
load->view('templates/FHC-Footer', $includesArray); ?>
diff --git a/public/js/api/factory/abgabe.js b/public/js/api/factory/abgabe.js
index 950f23ea9..be03c9728 100644
--- a/public/js/api/factory/abgabe.js
+++ b/public/js/api/factory/abgabe.js
@@ -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) {
diff --git a/public/js/apps/Abgabetool/Abgabetool.js b/public/js/apps/Abgabetool/Abgabetool.js
index d1c3e134c..83233ba22 100644
--- a/public/js/apps/Abgabetool/Abgabetool.js
+++ b/public/js/apps/Abgabetool/Abgabetool.js
@@ -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
diff --git a/public/js/components/Cis/Abgabetool/AbgabeMitarbeiterDetail.js b/public/js/components/Cis/Abgabetool/AbgabeMitarbeiterDetail.js
index edea46535..32e763eb1 100644
--- a/public/js/components/Cis/Abgabetool/AbgabeMitarbeiterDetail.js
+++ b/public/js/components/Cis/Abgabetool/AbgabeMitarbeiterDetail.js
@@ -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 = {
-
+
@@ -880,7 +857,7 @@ export const AbgabeMitarbeiterDetail = {
{{ $capitalize($p.t('abgabetool/c4signaturServerError')) }}
- {{ $p.t('abgabetool/c4noFileFound') }}
+ {{ $p.t('abgabetool/c4noSignatureCheckPossible') }}
diff --git a/public/js/components/Cis/Abgabetool/AbgabeStudentDetail.js b/public/js/components/Cis/Abgabetool/AbgabeStudentDetail.js
index c1573d05d..b8748c193 100644
--- a/public/js/components/Cis/Abgabetool/AbgabeStudentDetail.js
+++ b/public/js/components/Cis/Abgabetool/AbgabeStudentDetail.js
@@ -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 = {
{{projektarbeit?.titel}}
-
+
diff --git a/public/js/components/Cis/Abgabetool/AbgabetoolStudent.js b/public/js/components/Cis/Abgabetool/AbgabetoolStudent.js
index b16041b84..e9316c2b3 100644
--- a/public/js/components/Cis/Abgabetool/AbgabetoolStudent.js
+++ b/public/js/components/Cis/Abgabetool/AbgabetoolStudent.js
@@ -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)
diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php
index cc8e86de5..eda605e40 100644
--- a/system/phrasesupdate.php
+++ b/system/phrasesupdate.php
@@ -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',