From 3ccd38540d316d0d3efd88d745e9ea099abefae9 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 19 Jan 2018 16:50:36 +0100 Subject: [PATCH] =?UTF-8?q?updated=20CI=20person=20logging=20for=20Verarbe?= =?UTF-8?q?itungst=C3=A4tigkeit=20(taetigkeit=5Fkurzbz)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/libraries/PersonLogLib.php | 15 +++++++++------ application/models/system/PersonLog_model.php | 10 ++++++++-- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/application/libraries/PersonLogLib.php b/application/libraries/PersonLogLib.php index 6b63ba472..cf713825d 100644 --- a/application/libraries/PersonLogLib.php +++ b/application/libraries/PersonLogLib.php @@ -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)) { diff --git a/application/models/system/PersonLog_model.php b/application/models/system/PersonLog_model.php index 4725815f3..02f52008c 100644 --- a/application/models/system/PersonLog_model.php +++ b/application/models/system/PersonLog_model.php @@ -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))