Added method getLastStatus()

This method gets the latest Vertragsstatus for the given Vertrag and
Mitarbeiter.
This commit is contained in:
Cris
2019-09-24 10:15:21 +02:00
committed by hainberg
parent 812899e885
commit 1a58c977fe
@@ -200,6 +200,29 @@ class Vertrag_model extends DB_Model
return $this->execQuery($query, array($vertragsstatus_kurzbz, $vertrag_id, $mitarbeiter_uid, 'NOW()', getAuthUID(), null, null));
}
/**
* Get the latest Vertragsstatus for the given Vertrag and Mitarbeiter
* @param integer $vertrag_id
* @param string $mitarbeiter_uid
* @return array
*/
public function getLastStatus($vertrag_id, $mitarbeiter_uid)
{
$this->addSelect('vertragsstatus_kurzbz');
$this->addJoin('lehre.tbl_vertrag_vertragsstatus', 'vertrag_id');
$this->addOrder('datum', 'DESC');
$this->addLimit(1);
return $this->loadWhere(
array(
'vertrag_id' => $vertrag_id,
'uid' => $mitarbeiter_uid
)
);
}
// -----------------------------------------------------------------------------------------------------------------
// Private methods
/**
* Generate contract description.
* Example: WS2017-BEE3-LIA-LAB