From fa3a718ad4e0e8859e5e453ef327277e2d6b012f Mon Sep 17 00:00:00 2001 From: Cris Date: Thu, 21 Sep 2023 14:40:05 +0200 Subject: [PATCH] Added getAutocompleteSuggestions method to OE Model Get OEs by eventQuery string. Use with autocomplete event queries. --- .../organisation/Organisationseinheit_model.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/application/models/organisation/Organisationseinheit_model.php b/application/models/organisation/Organisationseinheit_model.php index bec4aee47..4a64ee055 100644 --- a/application/models/organisation/Organisationseinheit_model.php +++ b/application/models/organisation/Organisationseinheit_model.php @@ -188,4 +188,20 @@ class Organisationseinheit_model extends DB_Model } return $this->loadWhere($condition); } + + /** + * Get OEs by eventQuery string. Use with autocomplete event queries. + * @param $eventQuery String + * @return array + */ + public function getAutocompleteSuggestions($eventQuery) + { + $this->addSelect('oe_kurzbz'); + $this->addSelect('organisationseinheittyp_kurzbz, oe_kurzbz, bezeichnung, aktiv, lehre'); + $this->addOrder('organisationseinheittyp_kurzbz, bezeichnung'); + + return $this->loadWhere(" + oe_kurzbz ILIKE '%". $this->escapeLike($eventQuery). "%' + "); + } }