mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
Merge branch 'master' into vv_und_studvw_2026_02_rc4
This commit is contained in:
@@ -242,74 +242,89 @@ class Message_model extends DB_Model
|
||||
*/
|
||||
public function getMessagesForTable($person_id, $offset, $limit)
|
||||
{
|
||||
$sql_base = "
|
||||
SELECT
|
||||
$sql = <<<EOSQL
|
||||
with filtered_messages as (
|
||||
select
|
||||
m.message_id, m.person_id as sender_id, mr.person_id as recipient_id
|
||||
from
|
||||
public.tbl_msg_message m
|
||||
join
|
||||
public.tbl_msg_recipient mr on mr.message_id = m.message_id
|
||||
where
|
||||
m.person_id = ?
|
||||
group by
|
||||
m.message_id, m.person_id, mr.person_id
|
||||
|
||||
union all
|
||||
|
||||
select
|
||||
m.message_id, m.person_id as sender_id, mr.person_id as recipient_id
|
||||
from
|
||||
public.tbl_msg_message m
|
||||
join
|
||||
public.tbl_msg_recipient mr on mr.message_id = m.message_id
|
||||
where
|
||||
mr.person_id = ?
|
||||
group by
|
||||
m.message_id, m.person_id, mr.person_id
|
||||
|
||||
), lastmsgstatus as (
|
||||
select
|
||||
ms.*
|
||||
from (
|
||||
select
|
||||
s.message_id, s.person_id, MAX(s.insertamum) as lastinserted
|
||||
from
|
||||
public.tbl_msg_status s
|
||||
group by
|
||||
s.message_id, s.person_id
|
||||
) ls
|
||||
join
|
||||
public.tbl_msg_status ms on ms.message_id = ls.message_id and ms.person_id = ls.person_id and ms.insertamum = ls.lastinserted
|
||||
)
|
||||
|
||||
select
|
||||
(select count(*) from filtered_messages) as total_msgs,
|
||||
m.message_id AS message_id,
|
||||
m.subject AS subject,
|
||||
m.body AS body,
|
||||
m.insertamum AS insertamum,
|
||||
m.relationmessage_id AS relationmessage_id,
|
||||
(SELECT COALESCE(titelpre,'') || ' ' || COALESCE(vorname,'') || ' ' || COALESCE(nachname,'') || ' ' || COALESCE(titelpost,'') FROM public.tbl_person WHERE person_id = m.person_id) as sender,
|
||||
(SELECT COALESCE(titelpre,'') || ' ' || COALESCE(vorname,'') || ' ' || COALESCE(nachname,'') || ' ' || COALESCE(titelpost,'') FROM public.tbl_person WHERE person_id = r.person_id) as recipient,
|
||||
m.person_id as sender_id,
|
||||
r.person_id as recipient_id,
|
||||
MAX(ss.status) as status,
|
||||
MAX(ss.insertamum) as statusdatum
|
||||
FROM public.tbl_msg_message m
|
||||
JOIN public.tbl_msg_recipient r USING(message_id)
|
||||
JOIN public.tbl_msg_status ss ON(r.message_id = ss.message_id AND ss.person_id = r.person_id)
|
||||
WHERE m.person_id = ?
|
||||
GROUP BY m.message_id, m.subject, m.body, m.insertamum, m.relationmessage_id, sender, recipient, sender_id, recipient_id
|
||||
UNION ALL
|
||||
SELECT
|
||||
m.message_id AS message_id,
|
||||
m.subject AS subject,
|
||||
m.body AS body,
|
||||
m.insertamum AS insertamum,
|
||||
m.relationmessage_id AS relationmessage_id,
|
||||
(SELECT COALESCE(titelpre,'') || ' ' || COALESCE(vorname,'') || ' ' || COALESCE(nachname,'') || ' ' || COALESCE(titelpost,'') FROM public.tbl_person WHERE person_id = m.person_id) as sender,
|
||||
(SELECT COALESCE(titelpre,'') || ' ' || COALESCE(vorname,'') || ' ' || COALESCE(nachname,'') || ' ' || COALESCE(titelpost,'') FROM public.tbl_person WHERE person_id = r.person_id) as recipient,
|
||||
m.person_id as sender_id,
|
||||
r.person_id as recipient_id,
|
||||
MAX(ss.status) as status,
|
||||
MAX(ss.insertamum) as statusdatum
|
||||
FROM public.tbl_msg_recipient r
|
||||
JOIN public.tbl_msg_status ss USING(message_id, person_id)
|
||||
JOIN public.tbl_msg_message m USING(message_id)
|
||||
WHERE r.person_id = ?
|
||||
GROUP BY m.message_id, m.subject, m.body, m.insertamum, m.relationmessage_id, sender, recipient, sender_id, recipient_id
|
||||
";
|
||||
$sql = "
|
||||
SELECT COUNT(*) AS count FROM (
|
||||
" . $sql_base . "
|
||||
) a
|
||||
";
|
||||
|
||||
$parametersArray = array($person_id, $person_id);
|
||||
|
||||
$count = $this->execQuery($sql, $parametersArray);
|
||||
|
||||
if (isError($count))
|
||||
return $count;
|
||||
|
||||
$count = ceil(current(getData($count))->count/$limit);
|
||||
$sql = "
|
||||
SELECT * FROM (
|
||||
" . $sql_base . "
|
||||
) a
|
||||
ORDER BY insertamum DESC
|
||||
LIMIT ?
|
||||
OFFSET ?
|
||||
";
|
||||
(COALESCE(ps.titelpre,'') || ' ' || COALESCE(ps.vorname,'') || ' ' || COALESCE(ps.nachname,'') || ' ' || COALESCE(ps.titelpost,'')) as sender,
|
||||
(COALESCE(pr.titelpre,'') || ' ' || COALESCE(pr.vorname,'') || ' ' || COALESCE(pr.nachname,'') || ' ' || COALESCE(pr.titelpost,'')) as recipient,
|
||||
fm.sender_id,
|
||||
fm.recipient_id,
|
||||
ms.status,
|
||||
ms.insertamum as statusdatum
|
||||
from
|
||||
filtered_messages fm
|
||||
join
|
||||
public.tbl_msg_message m on fm.message_id = m.message_id
|
||||
join
|
||||
lastmsgstatus ms on fm.message_id = ms.message_id and fm.recipient_id = ms.person_id
|
||||
left join
|
||||
public.tbl_person ps on ps.person_id = fm.sender_id
|
||||
left join
|
||||
public.tbl_person pr on pr.person_id = fm.recipient_id
|
||||
order by
|
||||
m.insertamum DESC
|
||||
limit ?
|
||||
offset ?;
|
||||
EOSQL;
|
||||
|
||||
$parametersArray = array($person_id, $person_id, $limit, $offset);
|
||||
|
||||
$count = 0;
|
||||
$data = $this->execQuery($sql, $parametersArray);
|
||||
|
||||
if (isError($data))
|
||||
return $data;
|
||||
|
||||
$data = getData($data);
|
||||
if($data)
|
||||
{
|
||||
$count = ceil($data[0]->total_msgs / $limit);
|
||||
}
|
||||
|
||||
return success(['data' => $data, 'count' => $count]);
|
||||
}
|
||||
|
||||
@@ -51,6 +51,14 @@
|
||||
background-color: #6d4c41;
|
||||
}
|
||||
|
||||
.tag_dark_grey {
|
||||
background-color: #595959;
|
||||
}
|
||||
|
||||
.tag_light_grey {
|
||||
background-color: #9a9a9a;
|
||||
}
|
||||
|
||||
.tag_blau {
|
||||
background-color: #508498;
|
||||
}
|
||||
|
||||
@@ -643,6 +643,24 @@ export const AbgabeMitarbeiterDetail = {
|
||||
'projektarbeit'(newVal) {
|
||||
// set invertedFixtermin field for UI/UX purposes -> avoid double negation in text
|
||||
|
||||
// reset newTermin object
|
||||
const typ = this.abgabeTypeOptions.find(opt => opt.paabgabetyp_kurzbz === 'zwischen')
|
||||
this.newTermin = {
|
||||
'paabgabe_id': -1,
|
||||
'projektarbeit_id': newVal.projektarbeit_id,
|
||||
'fixtermin': false,
|
||||
'invertedFixtermin': true,
|
||||
'kurzbz': '',
|
||||
'datum': new Date().toISOString().split('T')[0],
|
||||
'note': this.allowedNotenOptions.find(opt => opt.note == 9),
|
||||
'beurteilungsnotiz': '',
|
||||
'upload_allowed': typ.upload_allowed_default,
|
||||
'paabgabetyp_kurzbz': '',
|
||||
'bezeichnung': typ,
|
||||
'abgabedatum': null,
|
||||
'insertvon': this.viewData?.uid ?? ''
|
||||
}
|
||||
|
||||
newVal?.abgabetermine?.forEach(termin => termin.invertedFixtermin = !termin.fixtermin)
|
||||
|
||||
// default select german if projektarbeit sprache was null
|
||||
@@ -711,6 +729,7 @@ export const AbgabeMitarbeiterDetail = {
|
||||
v-model="newTermin.bezeichnung"
|
||||
:options="getAllowedAbgabeTypeOptions"
|
||||
:optionLabel="getOptionLabelAbgabetyp"
|
||||
:optionDisabled="getOptionDisabled"
|
||||
scrollHeight="300px">
|
||||
</Dropdown>
|
||||
</div>
|
||||
|
||||
@@ -7,6 +7,7 @@ import ApiAbgabe from '../../../api/factory/abgabe.js'
|
||||
import ApiStudiensemester from '../../../api/factory/studiensemester.js';
|
||||
import AbgabeterminStatusLegende from "./StatusLegende.js";
|
||||
import FhcOverlay from "../../Overlay/FhcOverlay.js";
|
||||
import { splitMailsHelper } from "../../../helpers/EmailHelpers.js"
|
||||
|
||||
// spoofed date testing
|
||||
// const todayISO = '2025-08-08'
|
||||
@@ -226,18 +227,17 @@ export const AbgabetoolAssistenz = {
|
||||
]};
|
||||
},
|
||||
methods: {
|
||||
sammelMailStudent() {
|
||||
sammelMailStudent(param) {
|
||||
|
||||
const emails = this.selectedData
|
||||
.map(row => `${row.student_uid}@${this.domain}`)
|
||||
.join(',');
|
||||
|
||||
const uniqueRecipients = [...new Set(emails)];
|
||||
const subject = this.$p.t('abgabetool/c4sammelmailStudentBetreff', [this.selectedStudiengangOption?.bezeichnung]);
|
||||
|
||||
const href = `mailto:${emails}?subject=${subject}`;
|
||||
|
||||
window.location.href = href
|
||||
splitMailsHelper(uniqueRecipients, param.originalEvent, subject, this.$fhcAlert, this.$p)
|
||||
},
|
||||
sammelMailBetreuer() {
|
||||
sammelMailBetreuer(param) {
|
||||
|
||||
const recipientList = [];
|
||||
this.selectedData.forEach(row => {
|
||||
if (row.betreuer_mail) recipientList.push(row.betreuer_mail);
|
||||
@@ -246,11 +246,8 @@ export const AbgabetoolAssistenz = {
|
||||
|
||||
// actually not necessary for email clients but looks better for assistenz if we avoid duplicates here
|
||||
const uniqueRecipients = [...new Set(recipientList)];
|
||||
|
||||
const subject = this.$p.t('abgabetool/c4sammelmailBetreuerBetreff', [this.selectedStudiengangOption?.bezeichnung]);
|
||||
const href = `mailto:${uniqueRecipients.join(',')}?subject=${encodeURIComponent(subject)}`;
|
||||
|
||||
window.location.href = href;
|
||||
splitMailsHelper(uniqueRecipients, param.originalEvent, subject, this.$fhcAlert, this.$p)
|
||||
},
|
||||
selectHandler(e, cell) {
|
||||
const row = cell.getRow();
|
||||
@@ -969,7 +966,10 @@ export const AbgabetoolAssistenz = {
|
||||
// this.loadProjektarbeiten()
|
||||
|
||||
this.calcMaxTableHeight()
|
||||
}
|
||||
},
|
||||
getOptionDisabled(option) {
|
||||
return !option.aktiv
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
emailItems() {
|
||||
@@ -1179,7 +1179,8 @@ export const AbgabetoolAssistenz = {
|
||||
:style="{'width': '100%'}"
|
||||
v-model="serienTermin.bezeichnung"
|
||||
:options="abgabeTypeOptions"
|
||||
:optionLabel="getOptionLabelAbgabetyp">
|
||||
:optionLabel="getOptionLabelAbgabetyp"
|
||||
:optionDisabled="getOptionDisabled">
|
||||
</Dropdown>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1392,7 +1393,7 @@ export const AbgabetoolAssistenz = {
|
||||
>
|
||||
<i class="fa fa-envelope"></i>
|
||||
</button>
|
||||
<tiered-menu ref="menu" :model="emailItems" popup/>
|
||||
<tiered-menu ref="menu" :model="emailItems" popup :autoZIndex="false" />
|
||||
</template>
|
||||
</core-filter-cmpt>
|
||||
</div>
|
||||
|
||||
@@ -304,7 +304,7 @@ export const AbgabetoolMitarbeiter = {
|
||||
pa.isCurrent = res.data[1]
|
||||
|
||||
let paIsBenotet = false
|
||||
if(pa.note !== undefined && pa !== null) {
|
||||
if(pa.note !== undefined && pa.note !== null) {
|
||||
// check if the note is not defined as a non final projektarbeit note
|
||||
const opt = this.notenOptionsNonFinal.find(opt => opt.note)
|
||||
// if thats the case allow further work
|
||||
@@ -333,7 +333,6 @@ export const AbgabetoolMitarbeiter = {
|
||||
pa.student = `${pa.vorname} ${pa.nachname}`
|
||||
|
||||
this.selectedProjektarbeit = pa
|
||||
|
||||
this.$refs.modalContainerAbgabeDetail.show()
|
||||
|
||||
}).finally(()=>{this.loading = false})
|
||||
|
||||
@@ -316,6 +316,7 @@ export default {
|
||||
setHeader('statusdatum', this.$p.t('notiz', 'letzte_aenderung'));
|
||||
|
||||
this.$refs.table.tabulator.rowManager.getDisplayRows();
|
||||
this.$emit('tabulator_tablebuilt');
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -56,6 +56,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tablebuilt: false,
|
||||
isVisibleDiv: false,
|
||||
messageId: null
|
||||
}
|
||||
@@ -139,8 +140,10 @@ export default {
|
||||
},
|
||||
resetMessageId(){
|
||||
this.messageId = null;
|
||||
},
|
||||
tableBuilt: function() {
|
||||
this.tablebuilt = true;
|
||||
}
|
||||
|
||||
},
|
||||
template: `
|
||||
<div class="core-messages h-100 pb-3">
|
||||
@@ -155,6 +158,7 @@ export default {
|
||||
</form>
|
||||
|
||||
<message-modal
|
||||
v-if="tablebuilt"
|
||||
ref="modalMsg"
|
||||
:type-id="typeId"
|
||||
:id="id"
|
||||
@@ -166,8 +170,9 @@ export default {
|
||||
</message-modal>
|
||||
|
||||
<!--in same page-->
|
||||
<div v-show="isVisibleDiv" class="overflow-auto m-3" style="max-height: 500px; border: 1px solid #ccc;">
|
||||
<div v-if="isVisibleDiv" class="overflow-auto m-3" style="max-height: 500px; border: 1px solid #ccc;">
|
||||
<form-only
|
||||
v-if="tablebuilt"
|
||||
ref="templateNewDivMessage"
|
||||
:type-id="typeId"
|
||||
:id="id"
|
||||
@@ -187,6 +192,7 @@ export default {
|
||||
:openMode="openMode"
|
||||
@newMessage="handleMessage"
|
||||
@replyToMessage="handleMessage"
|
||||
@tabulator_tablebuilt="tableBuilt"
|
||||
>
|
||||
</table-messages>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { splitMailsHelper } from "../../../../helpers/EmailHelpers.js"
|
||||
export default {
|
||||
name: "Kontaktieren",
|
||||
computed: {
|
||||
@@ -22,60 +23,16 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
async splitMails(mails, event) {
|
||||
let splititem = ",";
|
||||
let maillist = mails.join(splititem);
|
||||
let mailto = "";
|
||||
|
||||
if (maillist.length > 2024)
|
||||
{
|
||||
if (await this.$fhcAlert.confirm({message: this.$p.t('stv', 'zuvieleEMails') }) === false)
|
||||
return;
|
||||
}
|
||||
|
||||
let firstrun = true;
|
||||
let useBcc = event?.ctrlKey || event?.metaKey;
|
||||
while (maillist.length > 0)
|
||||
{
|
||||
if (maillist.length > 2024)
|
||||
{
|
||||
let splitposition = maillist.lastIndexOf(splititem, 1900);
|
||||
mailto = maillist.substring(0, splitposition);
|
||||
maillist = maillist.substring(splitposition + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
mailto = maillist;
|
||||
maillist = "";
|
||||
}
|
||||
|
||||
let mailLink = useBcc ? `mailto:?bcc=${mailto}` : `mailto:${mailto}`;
|
||||
|
||||
if (firstrun)
|
||||
{
|
||||
window.location.href = mailLink;
|
||||
firstrun = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (await this.$fhcAlert.confirm({message: this.$p.t('stv', 'weitereEMail')}) === true)
|
||||
{
|
||||
window.location.href = mailLink;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
internMail(event) {
|
||||
if (this.internMails.length)
|
||||
{
|
||||
this.splitMails(this.internMails, event);
|
||||
splitMailsHelper(this.privateMails, event, null, this.$fhcAlert, this.$p)
|
||||
}
|
||||
},
|
||||
privateMail(event) {
|
||||
if (this.privateMails.length)
|
||||
{
|
||||
this.splitMails(this.privateMails, event);
|
||||
splitMailsHelper(this.privateMails, event, null, this.$fhcAlert, this.$p)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
export async function splitMailsHelper(mails, event, subject, alertPluginRef, phrasenPluginRef) {
|
||||
let splititem = ",";
|
||||
let maillist = mails.join(splititem);
|
||||
let mailto = "";
|
||||
// take subject line length + '?subject=' length into account
|
||||
const subjectlength = subject && typeof subject === 'string' ? subject.length + 9 : 0
|
||||
if (maillist.length > 2024)
|
||||
{
|
||||
if (await alertPluginRef.confirm({message: phrasenPluginRef.t('stv', 'zuvieleEMails') }) === false)
|
||||
return;
|
||||
}
|
||||
|
||||
let firstrun = true;
|
||||
let useBcc = event?.ctrlKey || event?.metaKey;
|
||||
while (maillist.length > 0)
|
||||
{
|
||||
if (maillist.length + subjectlength > 2024)
|
||||
{
|
||||
let splitposition = maillist.lastIndexOf(splititem, 1900);
|
||||
mailto = maillist.substring(0, splitposition);
|
||||
maillist = maillist.substring(splitposition + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
mailto = maillist;
|
||||
maillist = "";
|
||||
}
|
||||
|
||||
let mailLink = useBcc ? `mailto:?bcc=${mailto}` : `mailto:${mailto}`;
|
||||
if(subject && typeof subject === 'string') mailLink += `?subject=${subject}`
|
||||
if (firstrun)
|
||||
{
|
||||
window.location.href = mailLink;
|
||||
firstrun = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (await alertPluginRef.confirm({message: phrasenPluginRef.t('stv', 'weitereEMail')}) === true)
|
||||
{
|
||||
window.location.href = mailLink;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -91,6 +91,7 @@ require_once('dbupdate_3.4/69065_Projektarbeiten_Firmen_verwalten.php');
|
||||
require_once('dbupdate_3.4/68744_StV_settings.php');
|
||||
require_once('dbupdate_3.4/62889_reihungstest_ueberwachung_mit_constructor.php');
|
||||
require_once('dbupdate_3.4/71399_dashboard_update_widget_paths.php');
|
||||
require_once('dbupdate_3.4/71645_studvw_messagetab_ladezeit.php');
|
||||
|
||||
// *** Pruefung und hinzufuegen der neuen Attribute und Tabellen
|
||||
echo '<H2>Pruefe Tabellen und Attribute!</H2>';
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
if (! defined('DB_NAME')) exit('No direct script access allowed');
|
||||
|
||||
if ($result = $db->db_query("SELECT * FROM pg_class WHERE relname='idx_tbl_msg_message_person_id'"))
|
||||
{
|
||||
if ($db->db_num_rows($result) == 0)
|
||||
{
|
||||
$qry = "CREATE INDEX idx_tbl_msg_message_person_id ON public.tbl_msg_message USING btree (person_id)";
|
||||
|
||||
if (! $db->db_query($qry))
|
||||
echo '<strong>idx_tbl_msg_message_person_id: ' . $db->db_last_error() . '</strong><br>';
|
||||
else
|
||||
echo 'Index idx_tbl_msg_message_person_id angelegt<br>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($result = $db->db_query("SELECT * FROM pg_class WHERE relname='idx_tbl_msg_recipient_person_id'"))
|
||||
{
|
||||
if ($db->db_num_rows($result) == 0)
|
||||
{
|
||||
$qry = "CREATE INDEX idx_tbl_msg_recipient_person_id ON public.tbl_msg_recipient USING btree (person_id)";
|
||||
|
||||
if (! $db->db_query($qry))
|
||||
echo '<strong>idx_tbl_msg_recipient_person_id: ' . $db->db_last_error() . '</strong><br>';
|
||||
else
|
||||
echo 'Index idx_tbl_msg_recipient_person_id angelegt<br>';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user