Merge branch 'master' into feature-25999/C4_cleanup

This commit is contained in:
Harald Bamberger
2024-10-30 17:19:01 +01:00
26 changed files with 689 additions and 113 deletions
@@ -360,6 +360,7 @@ class Prestudentstatus_model extends DB_Model
$this->addSelect('ss.studienjahr_kurzbz');
$this->addSelect('pers.vorname');
$this->addSelect('pers.nachname');
$this->addSelect('pers.unruly');
$this->addSelect('TRIM(CONCAT(pers.vorname, \' \', pers.nachname)) AS name');
$this->addSelect('pers.person_id');
$this->addSelect('g.studiengang_kz');
@@ -642,12 +643,12 @@ class Prestudentstatus_model extends DB_Model
$this->addOrder('tbl_prestudentstatus.datum', 'DESC');
$this->addOrder('tbl_prestudentstatus.insertamum', 'DESC');
$this->addOrder('tbl_prestudentstatus.ext_id', 'DESC');
$this->addLimit(1);
$this->db->where('prestudent_id', $prestudent_id);
$this->db->where('status_kurzbz', self::STATUS_STUDENT);
$sql = $this->db->get_compiled_select($this->dbTable);
$this->addJoin('lehre.tbl_studienplan plan', 'studienplan_id', 'LEFT');
@@ -658,4 +659,4 @@ class Prestudentstatus_model extends DB_Model
'status_kurzbz' => self::STATUS_BEWERBER
]);
}
}
}
@@ -38,6 +38,7 @@ class Studierendenantrag_model extends DB_Model
$this->addSelect('studienjahr_kurzbz');
$this->addSelect('vorname');
$this->addSelect('nachname');
$this->addSelect('unruly');
$this->addSelect('p.prestudent_id');
$this->addSelect('p.studiengang_kz');
$this->addSelect('semester');
@@ -149,6 +150,8 @@ class Studierendenantrag_model extends DB_Model
$this->addSelect('s.studierendenantrag_statustyp_kurzbz status');
$this->addSelect('s.insertvon status_insertvon');
$this->addSelect('t.bezeichnung[(' . $lang . ')] statustyp');
$this->addSelect('p.unruly AS unruly');
$this->addSelect($this->dbTable . '.insertamum AS insertamum');
$this->addJoin(
'campus.tbl_studierendenantrag_status s',
@@ -158,6 +161,18 @@ class Studierendenantrag_model extends DB_Model
'campus.tbl_studierendenantrag_statustyp t',
's.studierendenantrag_statustyp_kurzbz=t.studierendenantrag_statustyp_kurzbz'
);
$this->addJoin(
'public.tbl_student st',
'st.prestudent_id=tbl_studierendenantrag.prestudent_id'
);
$this->addJoin(
'public.tbl_benutzer b',
'st.student_uid=b.uid'
);
$this->addJoin(
'public.tbl_person p',
'b.person_id=p.person_id'
);
if ($types && is_array($types)) {
$this->db->where_in('typ', $types);
+41 -8
View File
@@ -309,15 +309,15 @@ class Person_model extends DB_Model
{
$qry = "SELECT person_id
FROM public.tbl_prestudent p
JOIN
JOIN
(
SELECT DISTINCT ON(prestudent_id) *
FROM public.tbl_prestudentstatus
WHERE prestudent_id IN
WHERE prestudent_id IN
(
SELECT prestudent_id
FROM public.tbl_prestudent
WHERE person_id IN
SELECT prestudent_id
FROM public.tbl_prestudent
WHERE person_id IN
(
SELECT p2.person_id
FROM public.tbl_person p
@@ -331,8 +331,8 @@ class Person_model extends DB_Model
ORDER BY prestudent_id, datum DESC, insertamum DESC
) ps USING(prestudent_id)
JOIN public.tbl_status USING(status_kurzbz)
WHERE status_kurzbz = 'Interessent'
AND studiengang_kz IN
WHERE status_kurzbz = 'Interessent'
AND studiengang_kz IN
(
SELECT studiengang_kz
FROM public.tbl_prestudent p
@@ -389,5 +389,38 @@ class Person_model extends DB_Model
'prestudent_id' => $prestudent_id
]);
}
}
public function checkUnruly($vorname, $nachname, $gebdatum)
{
$qry = "SELECT person_id, vorname, nachname, gebdatum, unruly
FROM tbl_person
WHERE tbl_person.vorname = ?
AND tbl_person.nachname = ?
AND tbl_person.gebdatum = ?
AND tbl_person.unruly = TRUE;";
return $this->execQuery($qry, [$vorname, $nachname, $gebdatum]);
}
public function checkUnrulyWhere($where, $paramsArray)
{
$qry = 'SELECT *
FROM tbl_person p
WHERE '.$where.';';
return $this->execQuery($qry, $paramsArray);
}
public function updateUnruly($person_id, $unruly)
{
$result = $this->update($person_id, array(
'unruly' => $unruly
));
if (isError($result)) {
return error($result->msg, EXIT_ERROR);
} else if (isSuccess($result) && hasData($result)) {
return success($result);
}
}
}