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