Infolog - add ability to clear description history

This commit is contained in:
nathangray 2019-03-11 14:15:28 -06:00
parent 1206bc1987
commit e43c8f8f19
5 changed files with 36 additions and 1 deletions

View File

@ -85,6 +85,27 @@ class History
return $this->db->affected_rows(); 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 * Add a history record, if $new_value != $old_value
* *

View File

@ -1835,6 +1835,13 @@ class infolog_ui
$content = array_merge($content,$to_write); $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) elseif ($button == 'delete' && $info_id > 0)
{ {

View File

@ -99,4 +99,7 @@ div#infolog-edit_infolog-edit-description {
#infolog-index select#infolog-index_filter { #infolog-index select#infolog-index_filter {
width: 150px; width: 150px;
} }
#infolog_edit_info_responsible_chzn { width:99% !important;} #infolog_edit_info_responsible_chzn { width:99% !important;}
#infolog-edit_clean_history {
display: none;
}

View File

@ -4,6 +4,7 @@
<overlay> <overlay>
<template id="infolog.edit.description" template="" lang="" group="0" version="1.6.001"> <template id="infolog.edit.description" template="" lang="" group="0" version="1.6.001">
<textbox multiline="true" id="info_des" no_lang="1" width="99.7%" height="245px"/> <textbox multiline="true" id="info_des" no_lang="1" width="99.7%" height="245px"/>
<checkbox id="clean_history"/>
</template> </template>
<template id="infolog.edit.links" template="" lang="" group="0" version="1.3.001"> <template id="infolog.edit.links" template="" lang="" group="0" version="1.3.001">
<grid width="100%" overflow="auto"> <grid width="100%" overflow="auto">

View File

@ -167,6 +167,9 @@ div#infolog-edit_infolog-edit-description {
#infolog_edit_info_responsible_chzn { #infolog_edit_info_responsible_chzn {
width: 99% !important; width: 99% !important;
} }
#infolog-edit_clean_history {
display: none;
}
/*########################################### /*###########################################
# # # #
# dialogHeader # # dialogHeader #