diff --git a/application/controllers/Tempus.php b/application/controllers/Tempus.php index 175a9ffa4..78efde1b4 100644 --- a/application/controllers/Tempus.php +++ b/application/controllers/Tempus.php @@ -34,10 +34,18 @@ class Tempus extends Auth_Controller $this->load->model('organisation/Organisationseinheit_model', 'OrganisationseinheitModel'); $this->load->model('ressource/Kalenderstatus_model', 'KalenderStatusModel'); - $this->StudiengangModel->addOrder('typ'); - $this->StudiengangModel->addOrder('kurzbz'); - $this->StudiengangModel->addJoin('tbl_organisationseinheit', 'oe_kurzbz', 'LEFT'); - $organisationen = getData($this->StudiengangModel->loadWhere(array('tbl_studiengang.aktiv' => 'true'))); + $this->OrganisationseinheitModel->addJoin('tbl_studiengang', 'oe_kurzbz', 'LEFT'); + + $this->OrganisationseinheitModel->addSelect('public.tbl_organisationseinheit.organisationseinheittyp_kurzbz, + public.tbl_organisationseinheit.bezeichnung, + public.tbl_studiengang.studiengang_kz, + public.tbl_organisationseinheit.oe_kurzbz, + tbl_studiengang.typ, + COALESCE(public.tbl_studiengang.bezeichnung, \'\') as stgbezeichnung'); + $this->OrganisationseinheitModel->addOrder('tbl_organisationseinheit.aktiv', 'DESC'); + $this->OrganisationseinheitModel->addOrder('tbl_organisationseinheit.organisationseinheittyp_kurzbz'); + $organisationen = getData($this->OrganisationseinheitModel->loadWhere(array("tbl_organisationseinheit.aktiv" => true))); + $this->StudiensemesterModel->addOrder('start', 'DESC'); $studiensemestern = getData($this->StudiensemesterModel->load()); diff --git a/application/controllers/api/frontend/v1/tempus/KalenderSync.php b/application/controllers/api/frontend/v1/tempus/KalenderSync.php index ed5b7b145..13e4cc012 100644 --- a/application/controllers/api/frontend/v1/tempus/KalenderSync.php +++ b/application/controllers/api/frontend/v1/tempus/KalenderSync.php @@ -46,12 +46,18 @@ class KalenderSync extends FHCAPI_Controller $language = getUserLanguage() == 'German' ? 0 : 1; - $this->_ci->KalenderStatusModel->addSelect('tbl_kalender_syncstatus.*, array_to_json(bezeichnung_mehrsprachig::varchar[])->>' . $language .' AS sync_status_kurzbz, tbl_organisationseinheit.bezeichnung as oebezeichnung, tbl_studienplan.bezeichnung as studienplanbezeichnung'); + $this->_ci->KalenderStatusModel->addSelect('tbl_kalender_syncstatus.*, array_to_json(bezeichnung_mehrsprachig::varchar[])->>' . $language .' AS sync_status, tbl_organisationseinheit.bezeichnung as oebezeichnung, tbl_studienplan.bezeichnung as studienplanbezeichnung'); $this->_ci->KalenderStatusModel->addJoin('lehre.tbl_kalender_status', 'tbl_kalender_syncstatus.sync_status_kurzbz = tbl_kalender_status.status_kurzbz'); $this->_ci->KalenderStatusModel->addJoin('public.tbl_organisationseinheit', 'tbl_kalender_syncstatus.oe_kurzbz = tbl_organisationseinheit.oe_kurzbz'); $this->_ci->KalenderStatusModel->addJoin('lehre.tbl_studienplan', 'tbl_kalender_syncstatus.studienplan_id = tbl_studienplan.studienplan_id', 'LEFT'); + $this->_ci->KalenderStatusModel->addJoin('public.tbl_studiensemester', 'tbl_kalender_syncstatus.studiensemester_kurzbz = tbl_studiensemester.studiensemester_kurzbz'); + $this->_ci->KalenderStatusModel->addOrder('public.tbl_studiensemester.start', 'DESC'); - $data = $this->_ci->KalendersyncstatusModel->loadWhere(array('studiensemester_kurzbz' => $studiensemester_kurzbz)); + + if ($studiensemester_kurzbz === 'all') + $data = $this->_ci->KalendersyncstatusModel->load(); + else + $data = $this->_ci->KalendersyncstatusModel->loadWhere(array('tbl_kalender_syncstatus.studiensemester_kurzbz' => $studiensemester_kurzbz)); if (isError($data)) $this->terminateWithError(getError($data)); diff --git a/application/libraries/KalenderSyncLib.php b/application/libraries/KalenderSyncLib.php index ee0197e20..284a13274 100644 --- a/application/libraries/KalenderSyncLib.php +++ b/application/libraries/KalenderSyncLib.php @@ -18,6 +18,7 @@ class KalenderSyncLib $this->_ci->load->model('ressource/Kalender_model', 'KalenderModel'); $this->_ci->load->model('ressource/Kalendersyncstatus_model', 'KalendersyncstatusModel'); $this->_ci->load->model('organisation/Studiengang_model', 'StudiengangModel'); + $this->_ci->load->model('organisation/Organisationseinheit_model', 'OrganisationseinheitModel'); } public function run($studiensemester_kurzbz) @@ -181,17 +182,26 @@ class KalenderSyncLib $studiengang_kz = getData($studiengang_result); + if (!hasData($studiengang_result)) + { + $organisationseinheiten = $this->_ci->OrganisationseinheitModel->getChilds($oe_kurzbz); + $oe_kurzbz = hasData($organisationseinheiten) ? array_column(getData($organisationseinheiten), 'oe_kurzbz') : []; + } + $this->_ci->KalenderModel->addDistinct('tbl_kalender.kalender_id'); $this->_ci->KalenderModel->addSelect('tbl_kalender.kalender_id'); $this->_ci->KalenderModel->addJoin('lehre.tbl_kalender_lehreinheit', 'tbl_kalender.kalender_id = tbl_kalender_lehreinheit.kalender_id'); $this->_ci->KalenderModel->addJoin('lehre.tbl_lehreinheit', 'tbl_kalender_lehreinheit.lehreinheit_id = tbl_lehreinheit.lehreinheit_id'); $this->_ci->KalenderModel->addJoin('lehre.tbl_lehrveranstaltung', 'tbl_lehreinheit.lehrveranstaltung_id = tbl_lehrveranstaltung.lehrveranstaltung_id'); - //TODO (david) oe_kurzbz rekursiv? if (!is_null($studiengang_kz)) + { $this->_ci->KalenderModel->db->where('tbl_lehrveranstaltung.studiengang_kz', $studiengang_kz); + } else - $this->_ci->KalenderModel->db->where('tbl_lehrveranstaltung.oe_kurzbz', $oe_kurzbz); + { + $this->_ci->KalenderModel->db->where_in('tbl_lehrveranstaltung.oe_kurzbz', $oe_kurzbz); + } $this->_ci->KalenderModel->db->where('tbl_lehreinheit.studiensemester_kurzbz', $studiensemester_kurzbz); $this->_ci->KalenderModel->db->where_in('tbl_kalender.status_kurzbz', $status_kurzbz_list); diff --git a/application/libraries/RaumvorschlagLib.php b/application/libraries/RaumvorschlagLib.php index 8cb4aa8a4..7e4d254b9 100644 --- a/application/libraries/RaumvorschlagLib.php +++ b/application/libraries/RaumvorschlagLib.php @@ -23,7 +23,6 @@ class RaumvorschlagLib $this->_ci->load->model('organisation/gruppe_model', 'GruppeModel'); $this->_ci->load->model('organisation/Lehrverband_model', 'LehrverbandModel'); - $this->_ci->load->model('education/Lehreinheitgruppe_model', 'LehreinheitgruppeModel'); $this->_ci->load->model('education/Lehreinheitgruppe_model', 'LehreinheitgruppeModel'); $this->_ci->load->library('CollisionChecker'); diff --git a/public/js/components/Tempus/Modal.js b/public/js/components/Tempus/Modal.js index 981479aea..8a6232feb 100644 --- a/public/js/components/Tempus/Modal.js +++ b/public/js/components/Tempus/Modal.js @@ -34,29 +34,32 @@ export default { return []; return Array.from({length: this.max_semester}, (_, index) => index); + }, + studienplanTrigger() { + return [ + this.formData.oe_kurzbz, + this.formData.studiensemester_kurzbz, + this.formData.ausbildungssemester + ].join('|'); } }, watch: { - 'formData.oe_kurzbz'(newOrganisation) { + 'formData.oe_kurzbz'(newOrganisation) + { if (!newOrganisation) { this.max_semester = null; this.studienplaene = []; return; } - let filtered_org = this.config.organisationen.filter(org => org.oe_kurzbz === newOrganisation)[0]; + let filtered_org = (this.config.organisationen ?? []).filter(org => org.oe_kurzbz === newOrganisation)[0]; if (filtered_org && filtered_org.studiengang_kz) this.getSemester(filtered_org.studiengang_kz); else this.max_semester = null; - - this.getStudienplan(); }, - 'formData.studiensemester_kurzbz'() { - this.getStudienplan(); - }, - 'formData.ausbildungssemester'() { + studienplanTrigger() { this.getStudienplan(); } }, @@ -123,7 +126,7 @@ export default { this.$api.call(ApiTempusSync.getMaxSemester([stg_kz])) .then(response => response.data) .then(response => { - this.max_semester = response; + this.max_semester = response ?? null; let found = this.semester.filter(semester => semester === this.formData.ausbildungssemester); if (found.length === 0) @@ -146,7 +149,7 @@ export default { )) .then(response => response.data) .then(response => { - this.studienplaene = response; + this.studienplaene = response ?? []; let found = this.studienplaene.filter(plan => plan.studienplan_id === this.formData.studienplan_id); if (found.length === 0) this.formData.studienplan_id = null; @@ -168,7 +171,8 @@ export default { .call(ApiTempusSync.add(this.formData)) .then(() => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); - this.$emit('saved'); + if (this.stsem_kurzbz !== this.formData.studiensemester_kurzbz) + this.$emit('saved', this.formData.studiensemester_kurzbz); this.$refs.modal.hide(); }) .catch(this.$fhcAlert.handleSystemError); @@ -178,31 +182,35 @@ export default { .call(ApiTempusSync.updateSync(this.formData)) .then(() => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); - this.$emit('saved'); + if (this.stsem_kurzbz !== this.formData.studiensemester_kurzbz) + this.$emit('saved', this.formData.studiensemester_kurzbz); this.$refs.modal.hide(); }) .catch(this.$fhcAlert.handleSystemError); }, - start() { + start(data) { this.$refs.form - .call(ApiTempusSync.start(this.formData)) + .call(ApiTempusSync.start(data ?? this.formData)) .then(() => { - this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); - this.$emit('saved'); + this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successStart')); this.$refs.modal.hide(); }) .catch(this.$fhcAlert.handleSystemError); + }, + hideModal() + { + this.formData = {} } }, created() { - console.log(this.config) + this.$api .call(ApiTempusSync.getSyncStatus()) - .then(result => this.syncStati = result.data) + .then(result => this.syncStati = result.data ?? []) .catch(error => this.$fhcAlert.handleSystemError(error)); }, template: ` - + diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 138136891..e4e8023b1 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -39126,6 +39126,26 @@ array( ) ) ), + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'successStart', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => '"Erfolgreich gestartet', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Started successfully', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), array( 'app' => 'core', 'category' => 'ui',