AAFM#51747 OfficeApp ruimte data opvragen
svn path=/Website/branches/v2017.2/; revision=36505
This commit is contained in:
@@ -146,6 +146,7 @@ var api2_mapper = {
|
||||
"invoices" : { "filename": "appl/api2/api_invoices.asp", "module": "FIN" },
|
||||
"objects" : { "filename": "appl/api2/api_objects.asp", "module": "INS" },
|
||||
"inspections" : { "filename": "appl/api2/api_ins_deelsrtcontrole.asp", "module": "INS" },
|
||||
"statehistory" : { "filename": "appl/mgt/ins_deel_state_history.asp", "module": "INS" },
|
||||
"companies" : { "filename": "appl/api2/api_companies.asp", "module": "PRS" },
|
||||
"departments" : { "filename": "appl/mgt/prs_afdeling.asp", "module": "PRS" },
|
||||
|
||||
|
||||
60
APPL/API2/model_ins_deel_state_history.inc
Normal file
60
APPL/API2/model_ins_deel_state_history.inc
Normal file
@@ -0,0 +1,60 @@
|
||||
<% /*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: model_ins_deel_state_history.inc
|
||||
|
||||
Description: State history model.
|
||||
Parameters:
|
||||
Context:
|
||||
|
||||
Notes: Altijd readonly.
|
||||
Je moet WEB_INSUSE op de discipline hebben, er is (nog) geen 3D controle
|
||||
Verondersteld wordt dat je in de praktijk altijd filtert op
|
||||
bijvoorbeeld &start_statedate=2018-01-01T00:00:00Z
|
||||
*/
|
||||
|
||||
%>
|
||||
<%
|
||||
function model_ins_deel_state_history(params)
|
||||
{
|
||||
params = params || {};
|
||||
this.table = "ins_deel_state_history";
|
||||
this.primary = "ins_deel_state_history_key";
|
||||
this.records_name = "statehistory";
|
||||
this.record_name = "statehistory";
|
||||
this.autfunction = false; // Authorisatie alleen via ins_deel.ins_discipline_key
|
||||
|
||||
params.authparams = user.checkAutorisation("WEB_INSUSE");
|
||||
|
||||
this.fields = { "id" : { dbs: "ins_deel_state_history_key", typ: "key" },
|
||||
"object" : { dbs: "ins_deel_key", typ: "key", foreign: "ins_deel" },
|
||||
"state" : { dbs: "ins_deel_state", typ: "varchar" },
|
||||
"statedate": { dbs: "ins_deel_statedate", typ: "datetime" },
|
||||
"remark" : {
|
||||
"dbs": "ins_deel_state_history_opmerk",
|
||||
"typ": "memo"
|
||||
}
|
||||
};
|
||||
|
||||
var gparams = {
|
||||
GET: {
|
||||
tables: [
|
||||
"ins_deel"
|
||||
],
|
||||
wheres: [
|
||||
"ins_deel_state_history.ins_deel_key = ins_deel.ins_deel_key",
|
||||
"ins_deel.ins_discipline_key IN"
|
||||
+ " (SELECT ins_discipline_key"
|
||||
+ " FROM fac_v_webgebruiker"
|
||||
+ " WHERE fac_functie_key = " + params.authparams.autfunctionkey
|
||||
+ " AND prs_perslid_key = " + user_key
|
||||
+ " AND fac_gebruiker_prs_level_read < 9"
|
||||
+ " AND fac_gebruiker_alg_level_read < 9)"
|
||||
]
|
||||
}
|
||||
};
|
||||
this.REST_GET = generic_REST_GET(this, gparams);
|
||||
// updaten doe je door ins_deel.ins_deel_state te wijzigen
|
||||
}
|
||||
%>
|
||||
@@ -39,6 +39,10 @@ model_objects =
|
||||
"owner" : { dbs: "ins_v_deel_gegevens.prs_perslid_key", typ: "key", foreign: "prs_perslid" }
|
||||
},
|
||||
|
||||
// een include van model_ins_deel_state_history lijkt voor de hand te liggen
|
||||
// maar gaf (vast oplosbare) problemen met een dubbele ins_deel in de query
|
||||
// Bovendien wil je in de praktijk altijd een datumfilter op de statedatum hebben
|
||||
// wat niet kan op een include. Doe daarom maar /api2/statehistory?object=16506&start_statedate=2017-11-01T12:20:16Z&fields=state,statedate
|
||||
includes: { "tracking": {
|
||||
model: new model_tracking(['deel']),
|
||||
joinfield: "trackingrefkey"
|
||||
@@ -55,7 +59,6 @@ model_objects =
|
||||
var autfunction = urole == "fe"? "WEB_INSUSE" : "WEB_INSMAN";
|
||||
params.authparams = user.checkAutorisation(autfunction, null, null, true); // pessimistisch
|
||||
|
||||
// TODO: Add authorization
|
||||
var query = api2.sqlfields(params, model_objects);
|
||||
query.wheres.push("ins_deel_verwijder IS NULL");
|
||||
// Toon standaard alleen de niet vervallen objecten, behalve als specifiek op object identificatie wordt gezocht.
|
||||
@@ -73,6 +76,16 @@ model_objects =
|
||||
query.wheres.push("ins_alg_ruimte_key_org IS NULL");
|
||||
}
|
||||
|
||||
// TODO: Add 3D authorization
|
||||
// Alleen nog maar simpele 1D autorisatie
|
||||
query.wheres.push(" ins_deel.ins_discipline_key IN"
|
||||
+ " (SELECT ins_discipline_key"
|
||||
+ " FROM fac_v_webgebruiker"
|
||||
+ " WHERE fac_functie_key = " + params.authparams.autfunctionkey
|
||||
+ " AND prs_perslid_key = " + user_key
|
||||
+ " AND fac_gebruiker_prs_level_read < 9"
|
||||
+ " AND fac_gebruiker_alg_level_read < 9)");
|
||||
|
||||
// TODO: We ondersteunen uitsluitend ruimte- werkplek- en persoonsgebonden objecten
|
||||
query.tables.push("ins_v_deel_gegevens");
|
||||
query.wheres.push("ins_deel.ins_alg_ruimte_type IN ('R', 'W', 'P') ");
|
||||
|
||||
23
APPL/MGT/ins_deel_state_history.asp
Normal file
23
APPL/MGT/ins_deel_state_history.asp
Normal file
@@ -0,0 +1,23 @@
|
||||
<%@language = "javascript" %>
|
||||
|
||||
<!-- #include file="../scf/scaffolding.inc" -->
|
||||
<!-- #include file="../api2/model_ins_deel_state_history.inc" -->
|
||||
|
||||
<%
|
||||
var this_model = new model_ins_deel_state_history();
|
||||
|
||||
scaffolding(this_model,
|
||||
{
|
||||
"search": {
|
||||
"autosearch": true
|
||||
},
|
||||
"list": {
|
||||
"columns": [
|
||||
"id",
|
||||
"object",
|
||||
"state",
|
||||
"statedate"
|
||||
]
|
||||
}
|
||||
});
|
||||
%>
|
||||
Reference in New Issue
Block a user