AAIT#33956: Tracking uitbreiden op grondbeginselen financiele & rechten inrichting.

svn path=/Website/trunk/; revision=33192
This commit is contained in:
Maykel Geerdink
2017-03-20 14:29:39 +00:00
parent 0ef5e780a7
commit 755dd14f09
9 changed files with 83 additions and 38 deletions

View File

@@ -38,7 +38,7 @@ _model_bes_discipline = // Internal only
"records_name": "orderdisciplines",
"record_name": "orderdiscipline",
"table": "ins_tab_discipline",
"childtable": "bes_disc_params",
"audit": { "childtable": "bes_disc_params" }, // Parameters voor fac_audit.
"primary": "ins_discipline_key",
"soft_delete": "ins_discipline_verwijder",
"autfunction": "WEB_BESMSU",

View File

@@ -37,7 +37,7 @@ _model_cnt_discipline = // Internal only
"records_name":"contractdisciplines",
"record_name": "contractdiscipline",
"table": "ins_tab_discipline",
"childtable": "cnt_disc_params",
"audit": { "childtable": "cnt_disc_params" }, // Parameters voor fac_audit.
"primary": "ins_discipline_key",
"soft_delete": "ins_discipline_verwijder",
"autfunction": "WEB_CNTMGT",

View File

@@ -97,7 +97,7 @@ function model_fac_gebruikersgroep()
this.REST_GET = generic_REST_GET(this);
this.REST_POST = function (params, jsondata)
{
this._checkprotected(jsondata.fac_groep);
this._checkprotected(jsondata.authorizationgroup);
return generic_REST_POST(this)(params, jsondata);
}
// this.REST_PUT = generic_REST_PUT(this); // updated is wat overkill

View File

@@ -20,6 +20,14 @@ function model_fac_groep(groep_key, params)
this.records_name = "authorizationgroups";
this.record_name = "authorizationgroup";
this.table = "fac_groep";
this.audit = { // Parameters voor fac_audit.
"childtable": "fac_groeprechten",
"childaudit": {"sql": "SELECT fac_groeprechten_key"
+ " FROM fac_groeprechten"
+ " WHERE fac_groep_key IN ({0})",
"key": "fac_groeprechten_key"
}
};
this.primary = "fac_groep_key";
this.autfunction = "WEB_FACMSU";
this.record_title = L("fac_groep");

View File

@@ -19,7 +19,17 @@ function model_fac_profiel()
this.records_name = "profiles";
this.record_name = "profile";
this.table = "fac_profiel";
this.childtable = "fac_profielwaarde"
this.audit = { // Parameters voor fac_audit.
"childtable": "fac_profielwaarde",
"childaudit": {"sql": "SELECT fac_profielwaarde_key"
+ " FROM fac_profielwaarde"
+ " WHERE fac_profiel_key IN ({0})",
"key": "fac_profielwaarde_key",
"sqlget": "SELECT x.fac_profiel_key"
+ " FROM fac_profielwaarde x"
+ " WHERE x.fac_profielwaarde_key = {0}"
}
};
this.primary = "fac_profiel_key";
this.autfunction = "WEB_FINMSU";
this.record_title = L("fac_profiel");

View File

@@ -37,6 +37,7 @@ _model_ins_discipline = // Internal only
"records_name": "objectdisciplines",
"record_name": "objectdiscipline",
"table": "ins_tab_discipline",
"audit": { "childtable": "ins_disc_params" }, // Parameters voor fac_audit.
"primary": "ins_discipline_key",
"soft_delete": "ins_discipline_verwijder",
"autfunction": "WEB_INSMGT",

View File

@@ -36,7 +36,7 @@ _model_mld_discipline = // Internal only
"records_name": "issuedisciplines",
"record_name": "issuediscipline",
"table": "ins_tab_discipline",
"childtable": "mld_disc_params",
"audit": { "childtable": "mld_disc_params" }, // Parameters voor fac_audit.
"primary": "ins_discipline_key",
"autfunction": "WEB_MLDMGT",
"record_title": L("mld_discipline"),

View File

@@ -24,7 +24,25 @@ else
user.checkAutorisation("WEB_PRSSYS");
function gettablesql(ptable, pchildtable, pchildrecord, pmtable)
{
{ // Parentkey's van de childwaarden.
var pwhere_veldnaam = "";
if (ptable == "prs_perslid")
{
var pfac_audit_tabelkey = " (SELECT TO_NUMBER (x.fac_audit_waarde_oud)"
+ " FROM fac_audit x"
+ " WHERE x.fac_audit_veldnaam = 'prs_perslid_key'"
+ " AND fac_audit_tabelnaam = 'fac_gebruikersgroep'"
+ " AND x.fac_audit_tabelkey = a.fac_audit_tabelkey) fac_audit_tabelkey";
pwhere_veldnaam = " AND (a.fac_audit_veldnaam = 'prs_perslid_key' OR a.fac_audit_veldnaam = 'fac_groep_key')";
}
else
{
var pfac_audit_tabelkey = " (SELECT x.{0}_key".format(pmtable? pmtable : ptable)
+ " FROM " + pchildtable + " x"
+ " WHERE x.{0}_key = a.fac_audit_tabelkey) fac_audit_tabelkey".format(pchildtable);
}
return "(SELECT fac_audit_key"
+ " , fac_audit_tabelnaam"
+ " , fac_audit_tabelkey"
@@ -38,21 +56,20 @@ function gettablesql(ptable, pchildtable, pchildrecord, pmtable)
+ " FROM fac_audit"
+ " WHERE fac_audit_tabelnaam = " + safe.quoted_sql(ptable)
+ " UNION "
+ " SELECT fac_audit_key"
+ " SELECT a.fac_audit_key"
+ " , '{0}' fac_audit_tabelnaam".format(ptable)
+ " , (SELECT {0}_key".format(pmtable? pmtable : ptable)
+ " FROM " + pchildtable
+ " WHERE {0}_key = fac_audit_tabelkey) fac_audit_tabelkey".format(pchildtable)
+ " , fac_audit_veldnaam"
+ " , fac_audit_actie"
+ " , fac_audit_waarde_oud"
+ " , fac_audit_waarde_nieuw"
+ " , fac_audit_datum"
+ " , prs_perslid_key"
+ " , fac_audit_opmerking"
+ " FROM fac_audit"
+ " WHERE fac_audit_tabelnaam = " + safe.quoted_sql(pchildtable)
+ " AND fac_audit_tabelkey" + " IN (" + pchildrecord.join(",") + ")"
+ " , " + pfac_audit_tabelkey
+ " , a.fac_audit_veldnaam"
+ " , a.fac_audit_actie"
+ " , a.fac_audit_waarde_oud"
+ " , a.fac_audit_waarde_nieuw"
+ " , a.fac_audit_datum"
+ " , a.prs_perslid_key"
+ " , a.fac_audit_opmerking"
+ " FROM fac_audit a"
+ " WHERE a.fac_audit_tabelnaam = " + safe.quoted_sql(pchildtable)
+ pwhere_veldnaam
+ " AND a.fac_audit_tabelkey" + " IN (" + pchildrecord.join(",") + ")"
+ ") fac_audit";
}
var this_model = new model_fac_audit();
@@ -92,10 +109,10 @@ else
this_model.tablesql = "(SELECT *"
+ " FROM fac_audit "
+ " WHERE fac_audit_tabelnaam = " + safe.quoted_sql(table) + ") fac_audit";
var record = getQParamIntArray("record");
var childrecord = getQParamIntArray("childrecord", []);
if (table == "ins_tab_discipline") // dan disc_params er bij halen.
{
var record = getQParamIntArray("record");
var sql = "SELECT ins_discipline_module"
+ " FROM ins_tab_discipline"
+ " WHERE ins_discipline_key = " + record[0]; // Eerste keys zijn de ins_tab_discipline keys, daarna de disc_params keys. Eerste key is dan voldoende.
@@ -104,7 +121,7 @@ else
oRs.Close;
if (module != "mrk")
{
this_model.tablesql = gettablesql(table, childtable, childrecord, module + "_ins_discipline");
this_model.tablesql = gettablesql(table, childtable, childrecord, (module != "ins"? module + "_" : "") + "ins_discipline");
}
}
else if (childtable != "") // dan fac_profielwaarde er bij halen.

View File

@@ -45,9 +45,10 @@ function scaffolding_show(model, scf_params)
if (key > 0)
{
var tablekey_array = [key];
var parent_key_array = [key];
var sql = "";
//if (model.oms_veldnaam && model.oms)
// Fac_audit_tabelkey's van de verwijderde parents vinden.
if (model.table == "ins_tab_discipline")
{
sql = "SELECT ins_discipline_key"
@@ -55,6 +56,13 @@ function scaffolding_show(model, scf_params)
+ " WHERE ins_discipline_omschrijving = " + safe.quoted_sql(xxx_data.name)
+ " AND ins_discipline_key != " + key;
}
else if (model.softdelete)
{
sql = "SELECT x." + model.table + "_key"
+ " FROM " + model.table + " x"
+ " WHERE x." + model.table + "_verwijder IS NOT NULL"
+ " AND " + (model.fields.name.dbsa? model.fields.name.dbsa : model.fields.name.dbs) + " = " + safe.quoted_sql(xxx_data.name);
}
else if (model.fields.name && model.fields.name.dbs && xxx_data.name)
{
sql = "SELECT fac_audit_tabelkey"
@@ -69,13 +77,16 @@ function scaffolding_show(model, scf_params)
var oRs = Oracle.Execute(sql);
while(!oRs.eof)
{
tablekey_array.push(oRs(0).Value);
parent_key_array.push(oRs(0).Value);
oRs.Movenext();
}
}
// Verwijder audit van de verwijderde parents.
var wheres = ["(fac_audit_tabelnaam = " + safe.quoted_sql(model.table)
+ " AND fac_audit_tabelkey IN (" + tablekey_array.join(",") + "))"];
+ " AND fac_audit_tabelkey IN (" + parent_key_array.join(",") + "))"];
// Fac_audit_tabelkey's van de child audits vinden van de verwijderde en recente parents.
if (model.table == "ins_tab_discipline") // disc_params ook meetellen
{
var sql = "SELECT ins_discipline_module"
@@ -91,7 +102,7 @@ function scaffolding_show(model, scf_params)
key_field = "{0}_ins_discipline_key".format(module);
var sql = "SELECT {0}_disc_params_key disc_params_key".format(module)
+ " FROM {0}_disc_params".format(module)
+ " WHERE {0} IN ({1})".format(key_field, tablekey_array.join(","));
+ " WHERE {0} IN ({1})".format(key_field, parent_key_array.join(","));
var oRs = Oracle.Execute(sql);
var child_key_array = [];
while(!oRs.eof)
@@ -102,25 +113,23 @@ function scaffolding_show(model, scf_params)
oRs.Close;
wheres.push("(fac_audit_tabelnaam = " + safe.quoted_sql("{0}_disc_params".format(module))
+ " AND fac_audit_tabelkey" + " IN (" + child_key_array.join(",") + "))");
+ (child_key_array.length? " AND fac_audit_tabelkey" + " IN (" + child_key_array.join(",") + ")" : " AND 1=0") + ")");
}
}
else if (model.table == "fac_profiel")
else if (model.audit && model.audit.childaudit && model.audit.childaudit.sql)
{
var sql = "SELECT fac_profielwaarde_key"
+ " FROM fac_profielwaarde"
+ " WHERE fac_profiel_key IN (" + tablekey_array.join(",") + ")";
var sql = model.audit.childaudit.sql.format(parent_key_array.join(","));
var oRs = Oracle.Execute(sql);
var child_key_array = [];
while(!oRs.eof)
{
child_key_array.push(oRs("fac_profielwaarde_key").Value);
child_key_array.push(oRs(0).Value);
oRs.Movenext();
}
oRs.Close;
wheres.push("(fac_audit_tabelnaam = 'fac_profielwaarde'"
+ " AND fac_audit_tabelkey" + " IN (" + child_key_array.join(",") + "))");
wheres.push("(fac_audit_tabelnaam = '" + model.audit.childtable + "'"
+ (child_key_array.length? " AND fac_audit_tabelkey IN (" + child_key_array.join(",") + ")" : " AND 1=0") + ")");
}
var sql = "SELECT COUNT(*)"
+ " FROM fac_audit"
@@ -166,9 +175,9 @@ function scaffolding_show(model, scf_params)
function scf_history()
{
<%
var url = "appl/mgt/fac_audit.asp?mode=list&table={0}&record={1}".format(model.table, tablekey_array.join(","))
+ (child_key_array && child_key_array.length > 0
? "&childtable={0}&childrecord={1}".format(model.childtable, child_key_array.join(","))
var url = "appl/mgt/fac_audit.asp?mode=list&table={0}&record={1}".format(model.table, parent_key_array.join(","))
+ (child_key_array && child_key_array.length > 0 && model.audit && model.audit.childtable
? "&childtable={0}&childrecord={1}".format(model.audit.childtable, child_key_array.join(","))
: "");
var proturl = protectQS.create(url);
%>