AAIT#33956: Tracking / auditing

svn path=/Website/trunk/; revision=32489
This commit is contained in:
Jos Groot Lipman
2017-01-23 11:11:08 +00:00
parent 1b48a393c3
commit 4a13ea9561
3 changed files with 166 additions and 0 deletions

View File

@@ -0,0 +1,91 @@
<% /*
$Revision$
$Id$
File: model_fac_audit.inc
Description:
Notes:
*/
function fac_audit()
{
this.table = "fac_audit";
this.primary = "fac_audit_key";
this.records_name = "audits";
this.record_name = "audit";
this.autfunction = "WEB_FACTAB";
this.record_title = L("fac_audit");
this.records_title = L("fac_audit_m");
this.fields = {
"id": {
"dbs": "fac_audit_key",
"label": "Key",
"typ": "key",
"seq": "fac_s_fac_audit_key"
},
"table": {
"dbs": "fac_audit_tabelnaam",
"label": L("fac_audit_tabelnaam"),
"typ": "varchar",
"readonly": true
},
"record": {
"dbs": "fac_audit_tabelkey",
"label": L("fac_audit_tabelkey"),
"typ": "varchar",
"readonly": true
},
"column": {
"dbs": "fac_audit_veldnaam",
"label": L("fac_audit_veldnaam"),
"typ": "varchar",
"readonly": true
},
"type": {
"dbs": "fac_audit_actie",
"label": L("fac_audit_actie"),
"typ": "varchar",
"readonly": true,
"LOV": "U;Update;D;Delete"
//"LOV": L("fac_audit_typeLOV")
},
"old": {
"dbs": "fac_audit_waarde_oud",
"label": L("fac_audit_waarde_oud"),
"typ": "varchar",
"readonly": true
},
"new": {
"dbs": "fac_audit_waarde_nieuw",
"label": L("fac_audit_waarde_nieuw"),
"typ": "varchar",
"readonly": true
},
"person": {
"dbs": "prs_perslid_key",
"label": L("prs_perslid_key"),
"typ": "key",
"foreign": "prs_perslid",
"readonly": true
},
"description": {
"dbs": "fac_audit_opmerking",
"typ": "memo",
"label": L("fac_audit_opmerking")
},
"date": {
"dbs": "fac_audit_datum",
"label": L("fac_audit_datum"),
"typ": "datetime",
"readonly": true
}
}
this.REST_GET = generic_REST_GET(this);
//this.REST_POST = generic_REST_POST(this);
this.REST_PUT = generic_REST_PUT(this);
//this.REST_DELETE = generic_REST_DELETE(this);
}
%>

53
APPL/MGT/fac_audit.asp Normal file
View File

@@ -0,0 +1,53 @@
<%@language = "javascript" %>
<% /*
$Revision$
$Id$
File: fac_audit.asp
Description:
Context:
Notes:
*/
%>
<!-- #include file="../scf/scaffolding.inc" -->
<!-- #include file="../mgt/mgt_tools.inc" -->
<!-- #include file="../api2/model_fac_audit.inc" -->
<%
// Hmac controle en anders FACTAB eisen?
if (getQParam("hmac", ""))
protectQS.verify({ allowparams: ["outputmode", "showall", "autosortby", "no_autoscroll", "scf_highlight"]}); // tamper check
else
user.checkAutorisation("WEB_FACTAB");
var this_model = new fac_audit();
scaffolding(this_model,
{
"search": {
"autosearch": true,
"filters": [
"table",
"person"
]
},
"list": {
"columns": [
"id",
"type",
"column",
"old",
"new",
"date",
"person",
"description"
]
},
"edit": {
"modal": true
}
});
%>

View File

@@ -172,6 +172,15 @@ function scaffolding_edit(model, scf_params)
return true; // disable button
}
function scf_history()
{
<%
var url = "appl/mgt/fac_audit.asp?mode=list&table={0}&record={1}".format(model.table, key)
var proturl = protectQS.create(url);
%>
FcltMgr.openDetail("<%= proturl %>");
}
function scf_cancel()
{
FcltMgr.closeDetail(window, { cancel: true } );
@@ -250,6 +259,19 @@ function scaffolding_edit(model, scf_params)
</div>
<%
var buttons = [ ];
if (key > 0)
{
var sql = "SELECT COUNT(*)"
+ " FROM fac_audit"
+ " WHERE fac_audit_tabelnaam = " + safe.quoted_sql(model.table)
+ " AND fac_audit_tabelkey = " + key;
var oRs = Oracle.Execute(sql);
var cnt = oRs(0).Value;
oRs.Close();
if (cnt > 0)
buttons.push({title: L("lcl_history") + " ({0})".format(cnt), action:"scf_history()", icon: "fa-history", id: "btn_scf_history" });
}
if (scf_params.edit.buttons)
{
for (var i = 0; i < scf_params.edit.buttons.length; i++)