From e43c8f8f19c5fb92cc10cb173f96cf226365780c Mon Sep 17 00:00:00 2001 From: nathangray Date: Mon, 11 Mar 2019 14:15:28 -0600 Subject: [PATCH] Infolog - add ability to clear description history --- api/src/Storage/History.php | 21 +++++++++++++++++++++ infolog/inc/class.infolog_ui.inc.php | 7 +++++++ infolog/templates/default/app.css | 5 ++++- infolog/templates/default/edit.xet | 1 + infolog/templates/pixelegg/app.css | 3 +++ 5 files changed, 36 insertions(+), 1 deletion(-) diff --git a/api/src/Storage/History.php b/api/src/Storage/History.php index 9d29df9f60..5e2da548c4 100644 --- a/api/src/Storage/History.php +++ b/api/src/Storage/History.php @@ -85,6 +85,27 @@ class History return $this->db->affected_rows(); } + /** + * Delete history log of a certain field + * @param string $record_id ID of the record + * @param string $status Field name / ID + */ + function delete_field($record_id, $status) + { + $where = array( + 'history_appname' => $this->appname, + 'history_status' => $status + ); + + if (is_array($record_id) || is_numeric($record_id)) + { + $where['history_record_id'] = $record_id; + } + $this->db->delete(self::TABLE,$where,__LINE__,__FILE__); + + return $this->db->affected_rows(); + } + /** * Add a history record, if $new_value != $old_value * diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index ced2a20cbe..0f80e07835 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -1835,6 +1835,13 @@ class infolog_ui $content = array_merge($content,$to_write); } } + + // Need to purge description history after encryption? + if($content['clean_history']) + { + $history = new Api\Storage\History('infolog'); + $record_count = $history->delete_field($info_id, 'De'); + } } elseif ($button == 'delete' && $info_id > 0) { diff --git a/infolog/templates/default/app.css b/infolog/templates/default/app.css index 7ab8c9aaaa..b40ce3459f 100644 --- a/infolog/templates/default/app.css +++ b/infolog/templates/default/app.css @@ -99,4 +99,7 @@ div#infolog-edit_infolog-edit-description { #infolog-index select#infolog-index_filter { width: 150px; } -#infolog_edit_info_responsible_chzn { width:99% !important;} \ No newline at end of file +#infolog_edit_info_responsible_chzn { width:99% !important;} +#infolog-edit_clean_history { + display: none; +} \ No newline at end of file diff --git a/infolog/templates/default/edit.xet b/infolog/templates/default/edit.xet index 8b3c2a51cf..79ca2f972e 100644 --- a/infolog/templates/default/edit.xet +++ b/infolog/templates/default/edit.xet @@ -4,6 +4,7 @@