Ook vooral: mgt/mgt_tools naar api2/api2_tools verplaatst svn path=/Website/branches/v2017.2/; revision=35656
65 lines
2.3 KiB
PHP
65 lines
2.3 KiB
PHP
<% /*
|
|
$Revision$
|
|
$Id$
|
|
|
|
File: model_locations.inc
|
|
|
|
Description: Locatie model.
|
|
Parameters:
|
|
Context:
|
|
|
|
Notes:
|
|
*/
|
|
|
|
%>
|
|
<!-- #include file="../Shared/discxalg3d.inc"-->
|
|
<!-- #include file="./model_custom_fields.inc"-->
|
|
<!-- #include file="./model_alg_kenmerk.inc"-->
|
|
<%
|
|
function model_alg_locatie()
|
|
{
|
|
this.table = "alg_locatie";
|
|
this.primary = "alg_locatie_key";
|
|
this.records_name = "locations";
|
|
this.record_name = "location";
|
|
this.fields = {"id" : { dbs: "alg_locatie_key", typ: "key", filter: "exact" },
|
|
"code" : { dbs: "alg_locatie_code", typ: "varchar", filter: "like" },
|
|
"name" : { dbs: "alg_locatie_omschrijving", typ: "varchar"},
|
|
"district" : { dbs: "alg_district_key", typ: "key", foreign: "alg_district"},
|
|
"coordinate_x" : { dbs: "alg_locatie_x", typ: "number"},
|
|
"coordinate_y" : { dbs: "alg_locatie_y", typ: "number"}
|
|
};
|
|
this.REST_GET = function _GET(params)
|
|
{
|
|
var urole = "fe"; // TODO: Moet echt niet ter zake doen
|
|
var autfunction = urole == "fe"? "WEB_ALGUSE" : "WEB_ALGMAN";
|
|
params.authparams = user.checkAutorisation(autfunction, null, null, true); // pessimistisch
|
|
|
|
// TODO: Add authorization
|
|
var query = api2.sqlfields(params, this);
|
|
query.wheres.push("alg_locatie_verwijder IS NULL");
|
|
|
|
var wheres = api2.sqlfilter(params, this)
|
|
query.wheres = query.wheres.concat(wheres);
|
|
|
|
var sql = "SELECT " + query.selects.join(", ")
|
|
+ " FROM " + query.tables.join(", ")
|
|
+ " WHERE " + query.wheres.join(" AND " )
|
|
+ " ORDER BY alg_locatie_code";
|
|
|
|
var json = api2.sql2json (params, sql, this);
|
|
|
|
return json;
|
|
};
|
|
|
|
this.includes =
|
|
{
|
|
"custom_fields" : {
|
|
"model": new model_custom_fields(this, new model_alg_kenmerk("L", { internal: true }), { readman: true, readuse: true }),
|
|
"joinfield": "flexparentkey"
|
|
}
|
|
};
|
|
|
|
// Nog geen update
|
|
}
|
|
%> |