updated CI person logging for Verarbeitungstätigkeit (taetigkeit_kurzbz)

This commit is contained in:
alex
2018-01-19 16:50:36 +01:00
parent c268983785
commit 3ccd38540d
2 changed files with 17 additions and 8 deletions
+9 -6
View File
@@ -21,16 +21,18 @@ class PersonLogLib
* @param int $person_id ID of the Person.
* @param string $logtype_kurzbz Type of Log.
* @param array $logdata Array of the JSON Data to save.
* @param string $taetigkeit_kurzbz
* @param string $app Application that log belongs to.
* @param string $oe_kurzbz Organisation Unit the Log belongs to.
* @param string $user User who created the log.
* @return boolean true if success
* @return bool true if success
*/
public function log($person_id, $logtype_kurzbz, $logdata, $app = 'core', $oe_kurzbz = null, $user = null)
public function log($person_id, $logtype_kurzbz, $logdata, $taetigkeit_kurzbz, $app = 'core', $oe_kurzbz = null, $user = null)
{
$data = array(
'person_id' => $person_id,
'zeitpunkt' => date('Y-m-d H:i:s'),
'taetigkeit_kurzbz' => $taetigkeit_kurzbz,
'app' => $app,
'oe_kurzbz' => $oe_kurzbz,
'logtype_kurzbz' => $logtype_kurzbz,
@@ -49,13 +51,14 @@ class PersonLogLib
* Gets Logs for a Person, filtered by parameters.
* Requirements for retrieving log: name is set
* @param int $person_id ID of the Person.
* @param string $taetigkeit_kurzbz Verarbeitungstätigkeit
* @param string $app Name of the App.
* @param string $oe_kurzbz Organisations Unit.
* @return object $result
* @param string $oe_kurzbz Organisation Unit.
* @return array
*/
public function getLogs($person_id, $app = null, $oe_kurzbz = null)
public function getLogs($person_id, $taetigkeit_kurzbz = null, $app = null, $oe_kurzbz = null)
{
$result = $this->ci->PersonLogModel->filterLog($person_id, $app, $oe_kurzbz);
$result = $this->ci->PersonLogModel->filterLog($person_id, $taetigkeit_kurzbz, $app, $oe_kurzbz);
if (isSuccess($result))
{
@@ -35,11 +35,12 @@ class PersonLog_model extends CI_Model
/**
* Loads the last Log Entry of a Person
* @param int $person_id ID of the Person.
* @param string $taetigkeit_kurzbz Verarbeitungstätigkeit
* @param string $app Name of the App.
* @param string $oe_kurzbz Organisations Unit.
* @return object $result
*/
public function getLastLog($person_id, $app = null, $oe_kurzbz = null)
public function getLastLog($person_id, $taetigkeit_kurzbz = null, $app = null, $oe_kurzbz = null)
{
// Check Permissions
$this->load->library('PermissionLib');
@@ -49,6 +50,8 @@ class PersonLog_model extends CI_Model
$this->db->order_by('zeitpunkt', 'DESC');
$this->db->order_by('log_id', 'DESC');
$this->db->limit(1);
if (!is_null($taetigkeit_kurzbz))
$this->db->where('taetigkeit_kurzbz='.$this->db->escape($oe_kurzbz));
if (!is_null($app))
$this->db->where('app='.$this->db->escape($app));
if (!is_null($oe_kurzbz))
@@ -62,11 +65,12 @@ class PersonLog_model extends CI_Model
/**
* Load logs for a person, filtered by parameters
* @param int $person_id ID of the Person.
* @param string $taetigkeit_kurzbz Verarbeitungstätigkeit
* @param string $app Name of the App.
* @param string $oe_kurzbz Organisations Unit.
* @return object $result
*/
public function filterLog($person_id, $app = null, $oe_kurzbz = null)
public function filterLog($person_id, $taetigkeit_kurzbz = null, $app = null, $oe_kurzbz = null)
{
// Check Permissions
$this->load->library('PermissionLib');
@@ -75,6 +79,8 @@ class PersonLog_model extends CI_Model
$this->db->order_by('zeitpunkt', 'DESC');
$this->db->order_by('log_id', 'DESC');
if (!is_null($taetigkeit_kurzbz))
$this->db->where('taetigkeit_kurzbz='.$this->db->escape($taetigkeit_kurzbz));
if (!is_null($app))
$this->db->where('app='.$this->db->escape($app));
if (!is_null($oe_kurzbz))