mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-05 06:09:27 +00:00
98bb9987da
This allows display of column 'Betrag' in Lehraufträge annehmen. (Important for external lectors, who want to see Betrag of their new Lehrauftraege. They usually don't have active BIS Verwendung at the beginning of each term, therefor last (past) BIS Verwendung needs to be checked)
45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
<?php
|
|
class Bisverwendung_model extends DB_Model
|
|
{
|
|
|
|
/**
|
|
* Constructor
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->dbTable = 'bis.tbl_bisverwendung';
|
|
$this->pk = 'bisverwendung_id';
|
|
}
|
|
|
|
/**
|
|
* Get latest (active) Verwendung of the user.
|
|
* @param string $uid
|
|
* @param bool $active If false, returns latest Verwendung no matter if it is still actual.
|
|
* @return array
|
|
*/
|
|
public function getLast($uid, $active = true)
|
|
{
|
|
$this->addLimit(1);
|
|
|
|
if ($active)
|
|
{
|
|
$condition = '
|
|
mitarbeiter_uid = '. $this->escape($uid). '
|
|
AND ( beginn <= NOW() OR beginn IS NULL )
|
|
AND ( ende >= NOW() OR ende IS NULL )
|
|
ORDER BY ende DESC NULLS FIRST, beginn DESC NULLS LAST
|
|
';
|
|
}
|
|
else
|
|
{
|
|
$condition = '
|
|
mitarbeiter_uid = '. $this->escape($uid). '
|
|
ORDER BY ende DESC NULLS FIRST, beginn DESC NULLS LAST
|
|
';
|
|
}
|
|
|
|
return $this->loadWhere($condition);
|
|
}
|
|
}
|