From a218b3632343bc349b1086f2d5468db234b41705 Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 1 Feb 2021 10:03:18 +0100 Subject: [PATCH] Added getUID() by prestudentID - method to Prestudent Model Signed-off-by: cris-technikum --- application/models/crm/Prestudent_model.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/application/models/crm/Prestudent_model.php b/application/models/crm/Prestudent_model.php index 2e014800c..4ac78cb35 100644 --- a/application/models/crm/Prestudent_model.php +++ b/application/models/crm/Prestudent_model.php @@ -13,6 +13,27 @@ class Prestudent_model extends DB_Model $this->load->model('crm/prestudentstatus_model', 'PrestudentstatusModel'); } + + /** + * Get students UID by PrestudentID. + * @param $prestudent_id + * @return mixed + */ + public function getUID($prestudent_id) + { + $this->addSelect('uid'); + $this->addJoin('public.tbl_person', 'person_id'); + $this->addJoin('public.tbl_benutzer ', 'person_id'); + + $result = $this->load($prestudent_id); + + if (!hasData($result)) + { + show_error('Failed getting UID by prestudent_id'); + } + + return $result->retval[0]->uid; + } /** * getLastStatuses