Merge branch 'master' into bug-66890/studierendenverwaltung_statuswechsel_doppelte_statuseintraege

This commit is contained in:
Harald Bamberger
2025-10-01 13:24:45 +02:00
18 changed files with 260 additions and 110 deletions
@@ -60,17 +60,6 @@ class Favorites extends FHCAPI_Controller
$favorites = $this->input->post('favorites');
$removed = [];
while (strlen($favorites) > 64) {
$favObj = json_decode($favorites);
if (!$favObj->list)
break;
$removed[] = array_shift($favObj->list);
$favorites = json_encode($favObj);
}
if ($removed)
$this->addMeta('removed', $removed);
$result = $this->VariableModel->setVariable(getAuthUID(), 'stv_favorites', $favorites);
$this->getDataOrTerminateWithError($result);
@@ -434,7 +434,10 @@ class Kontakt extends FHCAPI_Controller
$this->FirmaModel->addJoin('public.tbl_firma f', 'ON (f.firma_id = st.firma_id)', 'LEFT');
$this->KontakttypModel->addJoin('public.tbl_kontakttyp kt', 'ON (public.tbl_kontakt.kontakttyp = kt.kontakttyp)');
$result = $this->KontaktModel->loadWhere(
array('person_id' => $person_id)
array(
'person_id' => $person_id,
'public.tbl_kontakt.kontakttyp !=' => 'hidden'
)
);
if (isError($result))
@@ -442,20 +445,18 @@ class Kontakt extends FHCAPI_Controller
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
$this->terminateWithSuccess((getData($result) ?: []));
}
public function getKontakttypen()
{
$this->load->model('person/Kontakttyp_model', 'KontakttypModel');
$this->KontakttypModel->addOrder('beschreibung', 'ASC');
$result = $this->KontakttypModel->loadWhere(array('kontakttyp !=' => 'hidden'));
$result = $this->KontakttypModel->load();
if (isError($result)) {
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
else
{
$this->terminateWithSuccess(getData($result) ?: []);
}
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
public function loadContact()
@@ -138,13 +138,24 @@ class Prestudent extends FHCAPI_Controller
{
$val = $this->input->post($prop, true);
if ($val !== null || $prop === 'foerderrelevant') {
if ($val !== null) {
if(in_array($prop, ['dual', 'bismelden', 'foerderrelevant']))
{
$val = boolval($val);
}
elseif (
$val === ''
&& in_array($prop, ['zgvnation', 'zgvmanation', 'zgvdoktornation', 'berufstaetigkeit_code', 'ausbildungcode'])
)
{
$val = null;
}
$update_prestudent[$prop] = $val;
}
// allowed to be null, but has to be in postparameter
if (
in_array($prop, ['zgvdatum', 'zgvmadatum', 'zgvdoktordatum', 'zgv_code', 'zgvmas_code', 'zgvdoktor_code'])
in_array($prop, ['foerderrelevant', 'zgvdatum', 'zgvmadatum', 'zgvdoktordatum', 'zgv_code', 'zgvmas_code', 'zgvdoktor_code'])
&& !isset($update_prestudent[$prop])
&& array_key_exists($prop, $_POST)
)
@@ -286,11 +286,11 @@ class Status extends FHCAPI_Controller
]);
$this->form_validation->set_rules('_default', '', [
['meldestichtag_not_exceeded', function () use ($datum, $isBerechtigtNoStudstatusCheck) {
['meldestichtag_not_exceeded', function () use ($datum_string, $isBerechtigtNoStudstatusCheck) {
if ($isBerechtigtNoStudstatusCheck)
return true; // Skip if access right says so
$result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($datum);
$result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($datum_string);
return !$this->getDataOrTerminateWithError($result);
}],
@@ -733,8 +733,9 @@ class Status extends FHCAPI_Controller
);
$result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($oldstatus->datum);
$isMeldestichtagErreicht = $this->getDataOrTerminateWithError($result);
if (!$this->getDataOrTerminateWithError($result))
if ($isMeldestichtagErreicht)
$this->terminateWithError(
$this->p->t('lehre', 'error_dataVorMeldestichtag'),
self::ERROR_TYPE_GENERAL,
@@ -276,7 +276,17 @@ class Student extends FHCAPI_Controller
$update_person = array();
foreach ($array_allowed_props_person as $prop) {
$val = $this->input->post($prop);
if ($val !== null) {
if ($val === null)
{
continue;
}
if($prop == 'foto')
{
$fotoval = ($val == '') ? null : str_replace('data:image/jpeg;base64,', '', $val);
$update_person[$prop] = $fotoval;
}
else
{
$update_person[$prop] = $val;
}
}
+8 -2
View File
@@ -214,7 +214,7 @@ class ProfilLib{
* @param integer $uid the userID used to get the kontakt information
* @return array all the kontakt information corresponding to a userID
*/
private function getKontaktInfo($pid)
private function getKontaktInfo($pid, $includehidden=false)
{
$this->ci->load->model("person/Kontakt_model","KontaktModel");
$this->ci->KontaktModel->addSelect(['kontakttyp', 'kontakt_id', 'kontakt', 'tbl_kontakt.anmerkung', 'tbl_kontakt.zustellung']);
@@ -222,7 +222,13 @@ class ProfilLib{
$this->ci->KontaktModel->addJoin('public.tbl_firma', 'firma_id', 'LEFT');
$this->ci->KontaktModel->addOrder('kontakttyp, kontakt, tbl_kontakt.updateamum, tbl_kontakt.insertamum');
$kontakte_res = $this->ci->KontaktModel->loadWhere(['person_id' => $pid]);
$params = array('person_id' => $pid);
if(!$includehidden)
{
$params['kontakttyp <>'] = 'hidden';
}
$kontakte_res = $this->ci->KontaktModel->loadWhere($params);
if(isError($kontakte_res)){
return error(getData($kontakte_res));
}
+10 -27
View File
@@ -2,6 +2,8 @@ import raum_contentmittitel from './Content_types/Raum_contentmittitel.js'
import general from './Content_types/General.js'
import BsConfirm from "../../Bootstrap/Confirm.js";
import news_content from './Content_types/News_content.js';
import iframe_content from './Content_types/Iframe_content.js';
import ApiCms from '../../../api/factory/cms.js';
export default {
@@ -24,42 +26,23 @@ export default {
raum_contentmittitel,
news_content,
general,
iframe_content
},
data() {
return {
content_type: null,
content: null,
content_id_internal: this.content_id
};
},
methods: {
fetchContent(){
return this.$api
this.$api
.call(ApiCms.content(this.content_id_internal, this.version, this.sprache, this.sichtbar))
.then(res => {
this.content = res.data.content;
this.content_type = res.data.type;
document.querySelectorAll("#cms [data-confirm]").forEach((el) => {
el.addEventListener("click", (evt) => {
evt.preventDefault();
BsConfirm.popup(el.dataset.confirm)
.then(() => {
Axios.get(el.href)
.then((res) => {
// TODO(chris): check for success then show message and/or reload
location = location;
})
.catch((err) => console.error("ERROR:", err));
})
.catch(() => {
});
});
});
document.querySelectorAll("#cms [data-href]").forEach((el) => {
el.href = el.dataset.href.replace(
/^ROOT\//,
FHC_JS_DATA_STORAGE_OBJECT.app_root
);
this.$nextTick(function() {
this.content = res.data.content;
this.content_type = res.data.type;
});
});
}
@@ -83,6 +66,8 @@ export default {
return "raum_contentmittitel";
case "news":
return "news_content";
case "iframe":
return "iframe_content";
default:
return "general";
};
@@ -91,8 +76,6 @@ export default {
created() {
this.fetchContent();
},
mounted() {
},
template: /*html*/ `
<!-- div that contains the content -->
<div id="fhc-cms-content" v-if="content">
@@ -0,0 +1,31 @@
import { replaceRelativeLegacyLink } from "../../../../helpers/LegacyLinkReplaceHelper.js";
export default {
name: "iframe_content",
props: {
content: { type: String, required: true }
},
computed: {
srcUrl() {
const parser = new DOMParser()
const doc = parser.parseFromString(`<div>${this.content}</div>`, "text/html");
const iframe = doc.querySelector("iframe[src]");
if (!iframe)
return "";
let url = iframe.getAttribute("src") || "";
return replaceRelativeLegacyLink(url);
}
},
template: `
<div class="w-100">
<iframe
v-if="srcUrl"
:src="srcUrl"
style="width:100%; height:90vh; border:0; display:block;"
></iframe>
<div v-else class="alert alert-warning">Keine URL gefunden.</div>
</div>
`
};
@@ -102,6 +102,13 @@ export default {
redirectToLeitung(){
this.$emit('redirectToLeitung', {
person_id: this.leitungData.person_id});
},
getFotoSrc(foto) {
if(foto === null) {
return FHC_JS_DATA_STORAGE_OBJECT.app_root + 'skin/images/profilbild_dummy.jpg';
} else {
return 'data:image/jpeg;base64,' + foto;
}
}
},
template: `
@@ -116,7 +123,7 @@ export default {
<img
class="d-block h-100 rounded"
alt="Profilbild"
:src="'data:image/jpeg;base64,' + person.foto"
:src="getFotoSrc(person.foto)"
/>
<template v-if="person.foto_sperre">
@@ -300,8 +300,7 @@ export default{
this.$api
.call(ApiStvContact.getTypes())
.then(result => {
//this.kontakttypen = result.data;
this.kontakttypen = result.data.filter(item => item.kontakttyp !== 'hidden');
this.kontakttypen = result.data;
})
.catch(this.$fhcAlert.handleSystemError);
},
@@ -326,7 +325,7 @@ export default{
v-model="contactData.kontakttyp">
>
<option value="">keine Auswahl</option>
<option v-for="typ in kontakttypen" :key="typ.kontakttyp_kurzbz" :value="typ.kontakttyp" >{{typ.beschreibung}}</option>
<option v-for="typ in kontakttypen" :key="typ.kontakttyp" :value="typ.kontakttyp">{{typ.beschreibung}}</option>
</form-input>
</div>
@@ -455,4 +454,4 @@ export default{
>
</core-filter-cmpt>
</div>`
};
};
@@ -318,6 +318,7 @@ export default {
name="zgvnation"
>
<!-- TODO(chris): gesperrte nationen können nicht ausgewählt werden! Um das zu realisieren müsste man ein pseudo select machen -->
<option value="">&nbsp;</option>
<option v-for="nation in lists.nations" :key="nation.nation_code" :value="nation.nation_code" :disabled="nation.sperre">{{nation.kurztext}}</option>
</form-input>
</div>
@@ -380,6 +381,7 @@ export default {
name="zgvmanation"
>
<!-- TODO(chris): gesperrte nationen können nicht ausgewählt werden! Um das zu realisieren müsste man ein pseudo select machen -->
<option value="">&nbsp;</option>
<option v-for="nation in lists.nations" :key="nation.nation_code" :value="nation.nation_code" :disabled="nation.sperre">{{nation.kurztext}}</option>
</form-input>
</div>
@@ -443,6 +445,7 @@ export default {
name="zgvdoktornation"
>
<!-- TODO(chris): gesperrte nationen können nicht ausgewählt werden! Um das zu realisieren müsste man ein pseudo select machen -->
<option value="">&nbsp;</option>
<option v-for="nation in lists.nations" :key="nation.nation_code" :value="nation.nation_code" :disabled="nation.sperre">{{nation.kurztext}}</option>
</form-input>
</div>
@@ -504,6 +507,7 @@ export default {
v-model="data.berufstaetigkeit_code"
name="berufstaetigkeit_code"
>
<option value="">&nbsp;</option>
<option v-for="beruf in listBerufe" :key="beruf.berufstaetigkeit_code" :value="beruf.berufstaetigkeit_code">{{beruf.berufstaetigkeit_bez}} </option>
</form-input>
<form-input
@@ -514,6 +518,7 @@ export default {
v-model="data.ausbildungcode"
name="ausbildungcode"
>
<option value="">&nbsp;</option>
<option v-for="ausbld in listAusbildung" :key="ausbld.ausbildungcode" :value="ausbld.ausbildungcode">{{ausbld.ausbildungbez}} </option>
</form-input>
</div>
@@ -205,7 +205,7 @@ export default{
];*/
},
template: `
<bs-modal class="stv-status-modal" ref="modal">
<bs-modal class="stv-status-modal" ref="modal" dialog-class="modal-dialog-scrollable">
<template #title>
{{ $p.t('lehre', statusNew ? 'status_new' : 'status_edit', prestudent) }}
</template>
@@ -112,26 +112,14 @@ export default {
return cp;
},
async filterFav() {
filterFav() {
this.favorites.on = !this.favorites.on;
this.$api
.call(this.endpoint.favorites.set(
JSON.stringify(this.favorites)
))
.then(result => {
if (result.meta?.removed) {
this.favorites.list = this.favorites.list
.filter(fav => !result.meta.removed.includes(fav));
const items = result.meta.removed.map(
rem => this.nodes.find(
node => node.data.link == rem
).label
).join(',\n');
this.$fhcAlert.alertWarning(this.$p.t('stv/warn_removed_favs', { items }));
}
});
));
},
async markFav(key) {
markFav(key) {
let index = this.favorites.list.indexOf(key.data.link + '');
if (index != -1) {
@@ -143,19 +131,7 @@ export default {
this.$api
.call(this.endpoint.favorites.set(
JSON.stringify(this.favorites)
))
.then(result => {
if (result.meta?.removed) {
this.favorites.list = this.favorites.list
.filter(fav => !result.meta.removed.includes(fav));
const items = "\n" + result.meta.removed.map(
rem => this.nodes.find(
node => node.data.link == rem
).label
).join(",\n");
this.$fhcAlert.alertWarning(this.$p.t('stv/warn_removed_favs', { items }));
}
});
));
},
unsetFavFocus(e) {
if (e.target.dataset?.linkFavAdd !== undefined) {
+1 -1
View File
@@ -9755,7 +9755,7 @@ COMMENT ON TABLE public.tbl_tag IS 'Orders and Company Tags';
CREATE TABLE public.tbl_variable (
name character varying(64) NOT NULL,
uid character varying(32) NOT NULL,
wert character varying(64)
wert text
);
+2
View File
@@ -77,6 +77,8 @@ require_once('dbupdate_3.4/55614_perm_verwaltetoe.php');
require_once('dbupdate_3.4/25999_C4_dashboard.php');
require_once('dbupdate_3.4/61730_Dashboard_Anpassungen.php');
require_once('dbupdate_3.4/40128_search.php');
require_once('dbupdate_3.4/63394_Variablenbeschraenkung.php');
require_once('dbupdate_3.4/63436_cis4_iframe_component.php');
require_once('dbupdate_3.4/60882_lehrfaecherverteilung_favorites.php');
require_once('dbupdate_3.4/66982_berufsschule.php');
@@ -0,0 +1,28 @@
<?php
if (!defined('DB_NAME')) exit('No direct script access allowed');
// Change type of wert in public.tbl_variable
if ($result = @$db->db_query("
SELECT data_type
FROM information_schema.columns
WHERE table_schema = 'public'
AND table_name = 'tbl_variable'
AND column_name = 'wert';
")) {
if ($db->db_num_rows($result) == 1)
{
$data_type = $db->db_fetch_row($result)[0];
if (strtolower($data_type) != 'text')
{
$qry = "ALTER TABLE public.tbl_variable
ALTER COLUMN wert
TYPE TEXT;";
if (!$db->db_query($qry))
echo '<strong>public.tbl_variable '.$db->db_last_error().'</strong><br>';
else
echo 'public.tbl_variable: Change type of "wert" to TEXT<br>';
}
}
}
@@ -0,0 +1,81 @@
<?php
$xsd= <<<EOD
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="content">
<xs:complexType>
<xs:sequence>
<xs:element name="url" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
EOD;
$xslt_xhtml= <<<EOD
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="UTF-8"/>
<xsl:template match="content">
<xsl:choose>
<xsl:when test="string(url)">
<iframe
src="{url}"
frameborder="0"
style="width:100%; height:90vh; border:0; display:block;"
>
</iframe>
</xsl:when>
<xsl:otherwise>
<div class="alert alert-warning">Keine URL im Inhalt gefunden.</div>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
EOD;
$xslt_xhtml_c4= <<<EOD
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="UTF-8"/>
<xsl:template match="content">
<xsl:choose>
<xsl:when test="string(url)">
<iframe
src="{url}"
frameborder="0"
style="width:100%; height:90vh; border:0; display:block;"
>
</iframe>
</xsl:when>
<xsl:otherwise>
<div class="alert alert-warning">Keine URL im Inhalt gefunden.</div>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
EOD;
if ($result = @$db->db_query("SELECT * FROM campus.tbl_template WHERE template_kurzbz='iframe'"))
{
if ($db->db_num_rows($result) == 0)
{
$sql= <<<EOD
INSERT INTO campus.tbl_template
(template_kurzbz, bezeichnung, xsd, xslt_xhtml, xslfo_pdf, xslt_xhtml_c4)
VALUES
('iframe','iFrame Content ', '{$xsd}', '{$xslt_xhtml}' , NULL, '{$xslt_xhtml_c4}');
EOD;
if (!$db->db_query($sql))
{
echo '<strong>campus.tbl_template: ' . $db->db_last_error() . '</strong><br>';
}
else
{
echo ' campus.tbl_template: Template "iframe" hinzugefügt.<br>';
}
}
}
+40 -20
View File
@@ -30686,6 +30686,26 @@ array(
)
)
),
array(
'app' => 'anwesenheiten',
'category' => 'global',
'phrase' => 'jetztStarten',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Jetzt Starten',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Start Now',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'anwesenheiten',
'category' => 'global',
@@ -38420,26 +38440,6 @@ array(
)
)
),
array(
'app' => 'core',
'category' => 'stv',
'phrase' => 'warn_removed_favs',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Zu viele Favoriten! Die folgenden Einträge wurden entfernt: {items}',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Too many favorites! The following entries were removed: {items}',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'stv',
@@ -42556,6 +42556,26 @@ array(
)
)
),
array(
'app' => 'core',
'category' => 'abgabetool',
'phrase' => 'c4abgabeStgSpezifischeRichtlinienBeachten',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => "Bitte beachten Sie gegebenenfalls existierende studiengangsspezifische Richtlinien und informieren Sie sich diesbezüglich. Vielen Dank.",
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Please note any existing program-specific guidelines and inform yourself about them. Thank you.',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'abgabetool',