Usability: Added 'ZGV' to STGL and lectors Detail site

Signed-off-by: cris-technikum <[email protected]>
This commit is contained in:
Cris
2021-04-06 14:48:08 +02:00
committed by cris-technikum
parent 5dafb3447b
commit 7c875d5f80
7 changed files with 53 additions and 7 deletions
@@ -581,4 +581,33 @@ class Prestudent_model extends DB_Model
return $this->execQuery($query, array($person_id));
}
/**
* Get latest ZGV Bezeichnung of Prestudent.
*
* @param $prestudent_id
*/
public function getLatestZGVBezeichnung($prestudent_id)
{
if (!is_numeric($prestudent_id))
{
show_error('Prestudent_id is not numeric.');
}
$language_index = getUserLanguage() == 'German' ? 0 : 1;
$this->addSelect('
COALESCE(
array_to_json(zgvmaster.bezeichnung::varchar[])->>' . $language_index . ',
array_to_json(zgv.bezeichnung::varchar[])->>' . $language_index . '
) AS bezeichnung'
);
$this->addJoin('bis.tbl_zgv zgv', 'zgv_code', 'LEFT');
$this->addJoin('bis.tbl_zgvmaster zgvmaster', 'zgvmas_code', 'LEFT');
return $this->loadWhere(array(
'prestudent_id' => $prestudent_id
));
}
}