mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0914562a71 | |||
| 3333b25d12 |
@@ -21,6 +21,8 @@ class Messages extends FHCAPI_Controller
|
||||
'getReplyData' => ['admin:r', 'assistenz:r'],
|
||||
'getPersonId' => ['admin:r', 'assistenz:r'],
|
||||
'getUid' => ['admin:r', 'assistenz:r'],
|
||||
'getStudiengang' => ['admin:r', 'assistenz:r'],
|
||||
|
||||
]);
|
||||
|
||||
//Load Models
|
||||
@@ -84,21 +86,17 @@ class Messages extends FHCAPI_Controller
|
||||
$this->terminateWithSuccess(array());
|
||||
}
|
||||
|
||||
public function getDataVorlage($vorlage_kurzbz)
|
||||
public function getDataVorlage($vorlage_kurzbz, $studiengang_kz)
|
||||
{
|
||||
$studiengang_kz = 0;
|
||||
$this->load->model('system/Vorlagestudiengang_model', 'VorlagestudiengangModel');
|
||||
$this->VorlagestudiengangModel->addOrder('version', 'DESC');
|
||||
if(!$studiengang_kz)
|
||||
$this->terminateWithSuccess(null);
|
||||
|
||||
$result = $this->VorlagestudiengangModel->loadWhere(
|
||||
[
|
||||
'vorlage_kurzbz' =>$vorlage_kurzbz,
|
||||
'studiengang_kz' => $studiengang_kz
|
||||
]);
|
||||
$this->load->model('system/Vorlagestudiengang_model', 'VorlagestudiengangModel');
|
||||
|
||||
$result = $this->VorlagestudiengangModel->getCurrent($vorlage_kurzbz, $studiengang_kz);
|
||||
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
$vorlage = current($data);
|
||||
$this->terminateWithSuccess($vorlage);
|
||||
$this->terminateWithSuccess(current($data));
|
||||
}
|
||||
|
||||
public function getMessageVarsPerson($id, $typeId)
|
||||
@@ -143,8 +141,6 @@ class Messages extends FHCAPI_Controller
|
||||
public function sendMessage($recipient_id)
|
||||
{
|
||||
//has to be uid
|
||||
// $this->terminateWithError("uid", $recipient_id, self::ERROR_TYPE_GENERAL);
|
||||
|
||||
//default setting
|
||||
$receiversPersonId = $this->_getPersonId($recipient_id, 'uid');
|
||||
|
||||
@@ -387,6 +383,21 @@ class Messages extends FHCAPI_Controller
|
||||
$this->terminateWithSuccess($benutzer->uid);
|
||||
}
|
||||
|
||||
public function getStudiengang($id, $typeId)
|
||||
{
|
||||
if($typeId!= "prestudent_id" && $typeId!="uid" )
|
||||
$this->terminateWithSuccess(null);
|
||||
|
||||
$prestudent_id = ($typeId == 'uid') ? $this->_getPrestudentIdFromUid($id) : $id;
|
||||
|
||||
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
|
||||
$result = $this->PrestudentModel->load($prestudent_id);
|
||||
$data = $this->getDataOrTerminateWithError($result);
|
||||
$studiengang_kz = current($data)->studiengang_kz;
|
||||
|
||||
return $this->terminateWithSuccess($studiengang_kz);
|
||||
}
|
||||
|
||||
private function _getPersonId($id, $typeId)
|
||||
{
|
||||
if ($typeId == 'uid' || $typeId == 'mitarbeiter_uid')
|
||||
@@ -416,7 +427,6 @@ class Messages extends FHCAPI_Controller
|
||||
|
||||
private function _getPrestudentIdFromUid($uid)
|
||||
{
|
||||
// $this->terminateWithError($uid, self::ERROR_TYPE_GENERAL);
|
||||
$this->load->model('crm/Student_model', 'StudentModel');
|
||||
$result = $this->StudentModel->loadWhere(
|
||||
['student_uid' => $uid]
|
||||
|
||||
@@ -62,10 +62,10 @@ export default {
|
||||
url: 'api/frontend/v1/messages/messages/getUid/' + userParams.id + '/' + userParams.type_id
|
||||
};
|
||||
},
|
||||
getDataVorlage(vorlage_kurzbz){
|
||||
getDataVorlage(vorlage_kurzbz, studiengang_kz){
|
||||
return {
|
||||
method: 'get',
|
||||
url: 'api/frontend/v1/messages/messages/getDataVorlage/' + vorlage_kurzbz
|
||||
url: 'api/frontend/v1/messages/messages/getDataVorlage/' + vorlage_kurzbz + '/' + studiengang_kz
|
||||
};
|
||||
},
|
||||
getNameOfDefaultRecipient(params){
|
||||
@@ -106,5 +106,11 @@ export default {
|
||||
method: 'post',
|
||||
url: 'api/frontend/v1/messages/messages/deleteMessage/' + messageId
|
||||
};
|
||||
}
|
||||
},
|
||||
getStudiengang(userParams){
|
||||
return {
|
||||
method: 'get',
|
||||
url: 'api/frontend/v1/messages/messages/getStudiengang/' + userParams.id + '/' + userParams.type_id
|
||||
};
|
||||
},
|
||||
}
|
||||
@@ -57,6 +57,7 @@ export default {
|
||||
previewBody: "",
|
||||
replyData: null,
|
||||
uid: null,
|
||||
studiengang_kz: null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -136,9 +137,9 @@ export default {
|
||||
}
|
||||
);
|
||||
},
|
||||
getDataVorlage(vorlage_kurzbz){
|
||||
getDataVorlage(vorlage_kurzbz, studiengang_kz){
|
||||
return this.$api
|
||||
.call(this.endpoint.getDataVorlage(vorlage_kurzbz))
|
||||
.call(this.endpoint.getDataVorlage(vorlage_kurzbz, studiengang_kz))
|
||||
.then(response => {
|
||||
this.formData.body = response.data.text;
|
||||
this.formData.subject = response.data.subject;
|
||||
@@ -193,7 +194,7 @@ export default {
|
||||
},
|
||||
handleSelectedVorlage(vorlage_kurzbz) {
|
||||
if (typeof vorlage_kurzbz === "string") {
|
||||
this.getDataVorlage(vorlage_kurzbz);
|
||||
this.getDataVorlage(vorlage_kurzbz, this.studiengang_kz);
|
||||
}
|
||||
},
|
||||
showPreview(){
|
||||
@@ -213,6 +214,18 @@ export default {
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
},
|
||||
getStudiengang(id, typeId){
|
||||
const params = {
|
||||
id: id,
|
||||
type_id: typeId
|
||||
};
|
||||
this.$api
|
||||
.call(this.endpoint.getStudiengang(params))
|
||||
.then(result => {
|
||||
this.studiengang_kz = result.data;
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
},
|
||||
show(){
|
||||
this.$refs.modalNewMessage.show();
|
||||
},
|
||||
@@ -235,7 +248,7 @@ export default {
|
||||
handler(newVal){
|
||||
if (newVal && newVal != null) {
|
||||
this.formData.subject = newVal;
|
||||
return this.getDataVorlage(newVal);
|
||||
return this.getDataVorlage(newVal, this.studiengang_kz);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -281,6 +294,7 @@ export default {
|
||||
}
|
||||
|
||||
if(this.typeId == 'prestudent_id' || this.typeId == 'uid'){
|
||||
this.getStudiengang(this.id, this.typeId);
|
||||
const params = {
|
||||
id: this.id,
|
||||
type_id: this.typeId
|
||||
@@ -290,6 +304,7 @@ export default {
|
||||
.then(result => {
|
||||
this.fieldsPrestudent = result.data;
|
||||
const prestudent = this.fieldsPrestudent[0];
|
||||
//this.studiengang_kz = prestudent.Studiengangskennzahl;
|
||||
this.itemsPrestudent = Object.entries(prestudent).map(([key, value]) => ({
|
||||
label: key.toLowerCase(),
|
||||
value: '{' + key.toLowerCase() + '}'
|
||||
|
||||
@@ -68,7 +68,8 @@ export default {
|
||||
previewBody: "",
|
||||
replyData: null,
|
||||
uid: null,
|
||||
messageSent: false
|
||||
messageSent: false,
|
||||
studiengang_kz: null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -136,9 +137,9 @@ export default {
|
||||
}
|
||||
);
|
||||
},
|
||||
getDataVorlage(vorlage_kurzbz){
|
||||
getDataVorlage(vorlage_kurzbz, studiengang_kz){
|
||||
return this.$api
|
||||
.call(this.endpoint.getDataVorlage(vorlage_kurzbz))
|
||||
.call(this.endpoint.getDataVorlage(vorlage_kurzbz, studiengang_kz))
|
||||
.then(response => {
|
||||
this.formData.body = response.data.text;
|
||||
this.formData.subject = response.data.subject;
|
||||
@@ -191,7 +192,7 @@ export default {
|
||||
},
|
||||
handleSelectedVorlage(vorlage_kurzbz) {
|
||||
if (typeof vorlage_kurzbz === "string") {
|
||||
this.getDataVorlage(vorlage_kurzbz);
|
||||
this.getDataVorlage(vorlage_kurzbz, this.studiengang_kz);
|
||||
}
|
||||
},
|
||||
hideTemplate(){
|
||||
@@ -218,7 +219,19 @@ export default {
|
||||
this.uid = result.data;
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
}
|
||||
},
|
||||
getStudiengang(id, typeId){
|
||||
const params = {
|
||||
id: id,
|
||||
type_id: typeId
|
||||
};
|
||||
this.$api
|
||||
.call(this.endpoint.getStudiengang(params))
|
||||
.then(result => {
|
||||
this.studiengang_kz = result.data;
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
'formData.body': {
|
||||
@@ -236,7 +249,7 @@ export default {
|
||||
|
||||
if (newVal && newVal != null) {
|
||||
this.formData.subject = newVal;
|
||||
return this.getDataVorlage(newVal);
|
||||
return this.getDataVorlage(newVal, this.studiengang_kz);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -264,6 +277,7 @@ export default {
|
||||
}
|
||||
|
||||
if (['prestudent_id', 'uid'].includes(this.typeId)){
|
||||
this.getStudiengang(this.id, this.typeId);
|
||||
const params = {
|
||||
id: this.id,
|
||||
type_id: this.typeId
|
||||
|
||||
Reference in New Issue
Block a user