change getStudienplaene from prestudent_id to array prestudent_ids

This commit is contained in:
ma0068
2024-06-19 14:31:47 +02:00
parent d6be83b48c
commit 58005d1832
3 changed files with 30 additions and 23 deletions
@@ -279,28 +279,16 @@ class Prestudent extends FHCAPI_Controller
return $this->terminateWithSuccess(getData($result) ?: []);
}
//TODO(manu) multi
public function getStudienplaene($prestudent_id)
public function getStudienplaene($prestudent_ids)
{
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
$result = $this->PrestudentModel->loadWhere(
array('prestudent_id' => $prestudent_id)
);
if (isError($result)) {
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
$result = current(getData($result));
$studiengang_kz = $result->studiengang_kz;
$prestudent_ids = urldecode($prestudent_ids);
$this->load->model('organisation/Studienplan_model', 'StudienplanModel');
$result = $this->StudienplanModel->getStudienplaeneByPrestudents($prestudent_ids);
$this->StudienplanModel->addOrder('studienplan_id', 'DESC');
$result = $this->StudienplanModel->getStudienplaene($studiengang_kz);
if (isError($result)) {
if (isError($result))
{
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
return $this->terminateWithSuccess(getData($result) ?: []);
@@ -119,4 +119,20 @@ class Studienplan_model extends DB_Model
'lv.lehrveranstaltung_id' => $lehrveranstaltung_id
]);
}
public function getStudienplaeneByPrestudents($prestudentIds)
{
$prestudentIds = intVal($prestudentIds);
$query = "
SELECT so.studienordnung_id, sp.bezeichnung
FROM public.tbl_prestudent ps
JOIN lehre.tbl_studienordnung so ON (ps.studiengang_kz = so.studiengang_kz)
JOIN lehre.tbl_studienplan sp ON (sp.studienordnung_id = so.studienordnung_id)
WHERE ps.prestudent_id IN (?)
ORDER BY so.studienordnung_id DESC
";
return $this->execQuery($query, array($prestudentIds));
}
}
@@ -55,6 +55,9 @@ export default{
}
return this.modelValue.map(e => e.prestudent_id);
},
paramIds(){
return Array.isArray(this.prestudentIds) ? this.prestudentIds.join(',') : this.prestudentIds;
},
updateData(){
const dataArray = [];
if (this.modelValue.prestudent_id) {
@@ -636,13 +639,13 @@ export default{
this.listStudiensemester = result;
})
.catch(this.$fhcAlert.handleSystemError);
/* this.$fhcApi
.get('api/frontend/v1/stv/prestudent/getStudienplaene/' + this.modelValue.prestudent_id)
this.$fhcApi
.get('api/frontend/v1/stv/prestudent/getStudienplaene/' + encodeURIComponent(this.paramIds))
.then(result => result.data)
.then(result => {
this.listStudienplaene = result;
})
.catch(this.$fhcAlert.handleSystemError);*/
.catch(this.$fhcAlert.handleSystemError);
this.$fhcApi
.get('api/frontend/v1/stv/status/getStatusgruende/')
.then(result => result.data)
@@ -661,7 +664,7 @@ export default{
mounted(){},
template: `
<div class="stv-list h-100 pt-3">
<!--Modal: statusModal-->
<BsModal ref="statusModal">
<template #title>
@@ -1018,12 +1021,12 @@ export default{
<!--MultiSelectButton-->
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
Status Ändern 2
Status Ändern
</button>
<ul class="dropdown-menu">
<li class="dropdown-submenu">
<a class="dropdown-item" @click="actionConfirmDialogue(updateData, 'abbrecherStgl', 'Abbrecher')">Abbrecher durch Stgl 2</a>
<a class="dropdown-item" @click="actionConfirmDialogue(updateData, 'abbrecherStgl', 'Abbrecher')">Abbrecher durch Stgl</a>
</li>
<li class="dropdown-submenu">
<a class="dropdown-item" @click="actionConfirmDialogue(updateData, 'abbrecherStud','Abbrecher')">Abbrecher durch Student</a>