mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
Added method getBetriebsmittel to Betriebsmittelperson Model
Signed-off-by: Cris <hainberg@technikum-wien.at>
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
class Betriebsmittelperson_model extends DB_Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@@ -11,4 +10,45 @@ class Betriebsmittelperson_model extends DB_Model
|
||||
$this->dbTable = 'wawi.tbl_betriebsmittelperson';
|
||||
$this->pk = 'betriebsmittelperson_id';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Betriebsmittel by person.
|
||||
* @param string $person_id
|
||||
* @param string $betriebsmitteltyp
|
||||
* @param bool $isRetourniert False to retrieve only active Betriebsmittel.
|
||||
* @return array|bool
|
||||
*/
|
||||
public function getBetriebsmittel($person_id, $betriebsmitteltyp = null, $isRetourniert = null)
|
||||
{
|
||||
if (!is_numeric($person_id))
|
||||
{
|
||||
$this->errormsg = 'Person_id type is not valid.';
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->addJoin('wawi.tbl_betriebsmittel', 'betriebsmittel_id');
|
||||
|
||||
$condition = '
|
||||
person_id = '. $this->escape($person_id). '
|
||||
';
|
||||
|
||||
if (is_string($betriebsmitteltyp)) {
|
||||
$condition .= '
|
||||
AND betriebsmitteltyp = ' . $this->escape($betriebsmitteltyp);
|
||||
}
|
||||
|
||||
if ($isRetourniert === true) {
|
||||
$condition .= '
|
||||
AND retouram IS NOT NULL'; // return date is given
|
||||
}
|
||||
elseif ($isRetourniert === false)
|
||||
{
|
||||
$condition .= '
|
||||
AND retouram IS NULL'; // default
|
||||
}
|
||||
|
||||
$this->addOrder('ausgegebenam', 'DESC'); // default
|
||||
|
||||
return $this->loadWhere($condition);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user