From a3963248dda37db5bd1c3c361af357d9c5c84b9d Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Wed, 29 Nov 2023 14:37:35 +0100 Subject: [PATCH 1/2] s&d --- application/libraries/AntragLib.php | 37 ++++++++++++++---------- application/models/crm/Student_model.php | 2 +- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/application/libraries/AntragLib.php b/application/libraries/AntragLib.php index f3eb4d152..ff4d5dc63 100644 --- a/application/libraries/AntragLib.php +++ b/application/libraries/AntragLib.php @@ -123,6 +123,8 @@ class AntragLib */ public function approveAbmeldung($studierendenantrag_ids, $insertvon) { + $this->_ci->load->model('crm/Student_model', 'StudentModel'); + $errors = []; foreach ($studierendenantrag_ids as $studierendenantrag_id) { $result = $this->_ci->StudierendenantragModel->load($studierendenantrag_id); @@ -251,10 +253,9 @@ class AntragLib $vorname = ''; $nachname = $name; } - $res = $this->_ci->KontaktModel->getZustellKontakt($prestudent->person_id, ['email']); + $res = $this->_ci->StudentModel->loadWhere(['prestudent_id' => $antrag->prestudent_id]); if (hasData($res)) { - $kontakt = current(getData($res)); - $email = $kontakt->kontakt; + $email = $this->_ci->StudentModel->getEmailFH(current(getData($res))->student_uid); $vorlage = $antrag->typ == Studierendenantrag_model::TYP_ABMELDUNG ? 'Student' : 'Stgl'; // NOTE(chris): Sancho mail @@ -335,6 +336,8 @@ class AntragLib $res = $this->_ci->PrestudentModel->load($antrag->prestudent_id); if (hasData($res)) { + $this->_ci->load->model('crm/Student_model', 'StudentModel'); + $prestudent = current(getData($res)); $res = $this->_ci->PersonModel->load($prestudent->person_id); if (hasData($res)) { @@ -345,10 +348,10 @@ class AntragLib } else { $name = $this->_ci->p->t('person', 'studentIn'); } - $res = $this->_ci->KontaktModel->getZustellKontakt($prestudent->person_id, ['email']); + + $res = $this->_ci->StudentModel->loadWhere(['prestudent_id' => $antrag->prestudent_id]); if (hasData($res)) { - $kontakt = current(getData($res)); - $email = $kontakt->kontakt; + $email = $this->_ci->StudentModel->getEmailFH(current(getData($res))->student_uid); $res = $this->_ci->StudierendenantragModel->getStgAndSem($antrag->studierendenantrag_id); $stg = ''; @@ -432,6 +435,7 @@ class AntragLib public function approveUnterbrechung($studierendenantrag_ids, $insertvon) { $this->_ci->load->model('person/Kontakt_model', 'KontaktModel'); + $this->_ci->load->model('crm/Student_model', 'StudentModel'); $errors = []; @@ -609,6 +613,7 @@ class AntragLib public function rejectUnterbrechung($studierendenantrag_ids, $insertvon, $grund) { $this->_ci->load->model('person/Kontakt_model', 'KontaktModel'); + $this->_ci->load->model('crm/Student_model', 'StudentModel'); $errors = []; @@ -755,7 +760,7 @@ class AntragLib } } - $res = $this->_ci->KontaktModel->getZustellKontakt($person_id, ['email']); + $res = $this->_ci->StudentModel->loadWhere(['prestudent_id' => $antrag->prestudent_id]); if (isError($res)) { $errors['email'] = getError($res); } else { @@ -764,7 +769,7 @@ class AntragLib if (!$res) { $errors['email'] = $this->_ci->p->t('studierendenantrag', 'error_no_email', ['person_id' => $person_id]); } else { - $result['email'] = current($res)->kontakt; + $result['email'] = $this->_ci->StudentModel->getEmailFH(current($res)->student_uid); } } } @@ -1517,6 +1522,8 @@ class AntragLib public function approveWiederholung($antrag_id, $insertvon) { + $this->_ci->load->model('crm/Student_model', 'StudentModel'); + $result = $this->_ci->StudierendenantragstatusModel->insert([ 'studierendenantrag_id' => $antrag_id, 'studierendenantrag_statustyp_kurzbz' => Studierendenantragstatus_model::STATUS_APPROVED, @@ -1571,10 +1578,10 @@ class AntragLib $mitarbeiter = getData($result); } - $result = $this->_ci->StudentModel->loadWhere(['prestudent_id'=> $antrag->prestudent_id]); + $result = $this->_ci->StudentModel->loadWhere(['prestudent_id'=> $prestudent_id]); if (hasData($result)) { - $student = current(getData($result)); - $student_uid = $student->student_uid; + $studentObj = current(getData($result)); + $student_uid = $studentObj->student_uid; } else $student_uid = ''; @@ -1596,10 +1603,8 @@ class AntragLib )) return error($this->_ci->p->t('studierendenantrag', 'error_mail_to', ['email' => $email])); - $result = $this->_ci->KontaktModel->getZustellKontakt($person->person_id, ['email']); - if (hasData($result)) { - $kontakt = current(getData($result)); - $email = $kontakt->kontakt; + if ($student_uid) { + $email = $this->_ci->StudentModel->getEmailFH($student_uid); $sem_not_allowed = $sem_to_repeat = ''; $list_not_allowed = $list_to_repeat = $this->_ci->p->t('studierendenantrag', 'mail_part_error_no_lvs'); @@ -1609,7 +1614,7 @@ class AntragLib $lvs = getData($result); foreach ($lvs as $sem => $lv_list) { $lvs_filtered = array_filter($lv_list, function ($el) { - return $el->antrag_zugelassen; + return property_exists($el, 'antrag_zugelassen') && $el->antrag_zugelassen; }); if (substr($sem, 0, 1) == '1') { $sem_not_allowed = substr($sem, 1); diff --git a/application/models/crm/Student_model.php b/application/models/crm/Student_model.php index e27fa68dc..4b0a70b1a 100644 --- a/application/models/crm/Student_model.php +++ b/application/models/crm/Student_model.php @@ -84,7 +84,7 @@ class Student_model extends DB_Model } /** - * Get the FH-Email for a student (not the private kontakt emailt) + * Get the FH-Email for a student (not the private kontakt email) * @param $student_uid * @return string */ From 483b6171c76727e1d027ee353ee346059ff0fc12 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Fri, 1 Dec 2023 09:39:46 +0100 Subject: [PATCH 2/2] add space between firstname and surname --- rdf/AntragAbmeldung.xml.php | 2 +- rdf/AntragAbmeldungStgl.xml.php | 2 +- rdf/AntragUnterbrechung.xml.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rdf/AntragAbmeldung.xml.php b/rdf/AntragAbmeldung.xml.php index 0de936e0a..515b1809a 100644 --- a/rdf/AntragAbmeldung.xml.php +++ b/rdf/AntragAbmeldung.xml.php @@ -57,7 +57,7 @@ if (!$db->db_query($query) || !$db->db_num_rows()) db_fetch_object()) { ?> - vorname . $row->nachname); ?>]]> + vorname . ' ' . $row->nachname); ?>]]> bezeichnung; ?>]]> bezeichnung_mehrsprachig; ?>]]> matrikelnr; ?>]]> diff --git a/rdf/AntragAbmeldungStgl.xml.php b/rdf/AntragAbmeldungStgl.xml.php index cccd677b0..4511be232 100644 --- a/rdf/AntragAbmeldungStgl.xml.php +++ b/rdf/AntragAbmeldungStgl.xml.php @@ -57,7 +57,7 @@ if (!$db->db_query($query) || !$db->db_num_rows()) db_fetch_object()) { ?> - vorname . $row->nachname); ?>]]> + vorname . ' ' . $row->nachname); ?>]]> bezeichnung; ?>]]> bezeichnung_mehrsprachig; ?>]]> matrikelnr; ?>]]> diff --git a/rdf/AntragUnterbrechung.xml.php b/rdf/AntragUnterbrechung.xml.php index 70a056b8a..ff3e68afa 100644 --- a/rdf/AntragUnterbrechung.xml.php +++ b/rdf/AntragUnterbrechung.xml.php @@ -58,7 +58,7 @@ if (!$db->db_query($query) || !$db->db_num_rows()) db_fetch_object()) { ?> - vorname . $row->nachname); ?>]]> + vorname . ' ' . $row->nachname); ?>]]> bezeichnung; ?>]]> bezeichnung_mehrsprachig; ?>]]> matrikelnr; ?>]]>