FSN#32922 model herzien savepoint
svn path=/Website/trunk/; revision=25750
This commit is contained in:
@@ -81,10 +81,6 @@ api2 = {
|
|||||||
var wheres = [];
|
var wheres = [];
|
||||||
if (params.filter)
|
if (params.filter)
|
||||||
{
|
{
|
||||||
if (model.parent_key in params.filter)
|
|
||||||
wheres.push(model.table + "." + model.parent_key + " = " + parseInt(params.filter[model.parent_key], 10));
|
|
||||||
else if ("pid" in params.filter)
|
|
||||||
wheres.push(model.table + "." + model.parent_key + " = " + parseInt(params.filter["pid"], 10));
|
|
||||||
for (var fld in model.fields)
|
for (var fld in model.fields)
|
||||||
{
|
{
|
||||||
var field = model.fields[fld];
|
var field = model.fields[fld];
|
||||||
@@ -133,7 +129,8 @@ api2 = {
|
|||||||
else if (String(filterval).indexOf(",") != -1) // let op: bij buildings/1234.json is id al numeriek gemaakt
|
else if (String(filterval).indexOf(",") != -1) // let op: bij buildings/1234.json is id al numeriek gemaakt
|
||||||
// NB: index=-1 als het geen array is.
|
// NB: index=-1 als het geen array is.
|
||||||
{
|
{
|
||||||
safe_val = getQParamIntArray(fld).join(","); // TODO: Niet via getQParamIntArray
|
var arr = params.filter[fld].split(",");
|
||||||
|
safe_val = safe.int_array(arr).join(",");
|
||||||
if (typeof filter != 'function')
|
if (typeof filter != 'function')
|
||||||
safe_val = "(" + safe_val + ")";
|
safe_val = "(" + safe_val + ")";
|
||||||
operand = " IN ";
|
operand = " IN ";
|
||||||
@@ -443,6 +440,10 @@ api2 = {
|
|||||||
}
|
}
|
||||||
inccnt ++;
|
inccnt ++;
|
||||||
inc.model.aliasprefix = "I" + inccnt + "_";
|
inc.model.aliasprefix = "I" + inccnt + "_";
|
||||||
|
|
||||||
|
// Zorg dat de parent_key niet genoemd wordt bij de children. Dat is redundant
|
||||||
|
if (inc.joinfield in inc.model.fields)
|
||||||
|
inc.model.fields[inc.joinfield].hidden = true;
|
||||||
var incquery = api2.sqlfields(params, inc.model);
|
var incquery = api2.sqlfields(params, inc.model);
|
||||||
|
|
||||||
selects = selects.concat (incquery.selects);
|
selects = selects.concat (incquery.selects);
|
||||||
@@ -466,7 +467,7 @@ api2 = {
|
|||||||
// gedrag wel fijn.
|
// gedrag wel fijn.
|
||||||
orderbys.push(inc.model.aliasprefix + inc.model.primary);
|
orderbys.push(inc.model.aliasprefix + inc.model.primary);
|
||||||
// simpel op joinfield
|
// simpel op joinfield
|
||||||
wheres.push ( model.table + "." + model.primary + "=" + inc.model.table + "." + inc.joinfield + "(+)");
|
wheres.push ( model.table + "." + model.primary + "=" + inc.model.table + "." + inc.model.fields[inc.joinfield].dbs + "(+)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -702,6 +703,17 @@ api2 = {
|
|||||||
options.push("<option value='" + safe.htmlattr(l) + "'" + (l == current?" selected='1'":"") + ">" + safe.html(spl[l]) + "</option>");
|
options.push("<option value='" + safe.htmlattr(l) + "'" + (l == current?" selected='1'":"") + ">" + safe.html(spl[l]) + "</option>");
|
||||||
return "<select>" + options.join("") + "</select>";
|
return "<select>" + options.join("") + "</select>";
|
||||||
},
|
},
|
||||||
|
// ['xxx','yyy','zzz'] ==> "0;xxx;1;yyy;2;zzz"
|
||||||
|
makeLOV: function _makeLOV(arr)
|
||||||
|
{
|
||||||
|
var LOVarr = [];
|
||||||
|
for (var i = 0; i < arr.length; i++)
|
||||||
|
{
|
||||||
|
LOVarr.push(String(i));
|
||||||
|
LOVarr.push(arr[i]);
|
||||||
|
}
|
||||||
|
return LOVarr.join(";");
|
||||||
|
},
|
||||||
// Geef alle velden van een record terug
|
// Geef alle velden van een record terug
|
||||||
sql2jsonfields: function (oRs, model)
|
sql2jsonfields: function (oRs, model)
|
||||||
{
|
{
|
||||||
@@ -957,23 +969,26 @@ api2 = {
|
|||||||
}
|
}
|
||||||
NOT_A_DATE;
|
NOT_A_DATE;
|
||||||
},
|
},
|
||||||
generic_REST: function(model)
|
generic_REST: function(model, gparams)
|
||||||
{
|
{
|
||||||
|
gparams = gparams || {};
|
||||||
if (typeof model == "function") // Nieuwe stijl is het een function. Even compatible.
|
if (typeof model == "function") // Nieuwe stijl is het een function. Even compatible.
|
||||||
model = new model();
|
model = new model();
|
||||||
|
|
||||||
if (!model.autfunction)
|
if (!model.autfunction)
|
||||||
GENERIC_ONLY_WITH_AUTFUNCTION;
|
GENERIC_ONLY_WITH_AUTFUNCTION;
|
||||||
|
|
||||||
model.REST_GET = generic_REST_GET(model);
|
model.REST_GET = generic_REST_GET(model, gparams);
|
||||||
model.REST_POST = generic_REST_POST(model);
|
model.REST_POST = generic_REST_POST(model, gparams);
|
||||||
model.REST_PUT = generic_REST_PUT(model);
|
model.REST_PUT = generic_REST_PUT(model, gparams);
|
||||||
model.REST_DELETE = generic_REST_DELETE(model);
|
model.REST_DELETE = generic_REST_DELETE(model, gparams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function generic_REST_GET(model)
|
function generic_REST_GET(model, gparams)
|
||||||
{
|
{
|
||||||
|
gparams = gparams || {};
|
||||||
|
gparams.GET = gparams.GET || {};
|
||||||
user.checkAutorisation(model.autfunction); // Als je zelfs geen readrechten hebt ben je heel fout bezig
|
user.checkAutorisation(model.autfunction); // Als je zelfs geen readrechten hebt ben je heel fout bezig
|
||||||
|
|
||||||
return function _generic_REST_GET(params, jsondata)
|
return function _generic_REST_GET(params, jsondata)
|
||||||
@@ -983,6 +998,12 @@ function generic_REST_GET(model)
|
|||||||
var wheres = api2.sqlfilter(params, model);
|
var wheres = api2.sqlfilter(params, model);
|
||||||
query.wheres = query.wheres.concat(wheres);
|
query.wheres = query.wheres.concat(wheres);
|
||||||
|
|
||||||
|
if (gparams.GET.tables)
|
||||||
|
query.tables = query.tables.concat(gparams.GET.tables);
|
||||||
|
|
||||||
|
if (gparams.GET.wheres)
|
||||||
|
query.wheres = query.wheres.concat(gparams.GET.wheres);
|
||||||
|
|
||||||
if (model.soft_delete && params.filter.show_deleted != "on")
|
if (model.soft_delete && params.filter.show_deleted != "on")
|
||||||
query.wheres.push(model.soft_delete + " IS NULL");
|
query.wheres.push(model.soft_delete + " IS NULL");
|
||||||
|
|
||||||
@@ -999,8 +1020,9 @@ function generic_REST_GET(model)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function generic_REST_POST(model)
|
function generic_REST_POST(model, gparams)
|
||||||
{
|
{
|
||||||
|
gparams = gparams || {};
|
||||||
var autparams = user.checkAutorisation(model.autfunction, true);
|
var autparams = user.checkAutorisation(model.autfunction, true);
|
||||||
if (!autparams || autparams.PRSwritelevel == 9 || autparams.ALGwritelevel == 9)
|
if (!autparams || autparams.PRSwritelevel == 9 || autparams.ALGwritelevel == 9)
|
||||||
return false;
|
return false;
|
||||||
@@ -1026,8 +1048,9 @@ function generic_REST_POST(model)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function generic_REST_PUT(model)
|
function generic_REST_PUT(model, gparams)
|
||||||
{
|
{
|
||||||
|
gparams = gparams || {};
|
||||||
var autparams = user.checkAutorisation(model.autfunction, true);
|
var autparams = user.checkAutorisation(model.autfunction, true);
|
||||||
if (!autparams || autparams.PRSwritelevel == 9 || autparams.ALGwritelevel == 9)
|
if (!autparams || autparams.PRSwritelevel == 9 || autparams.ALGwritelevel == 9)
|
||||||
return false;
|
return false;
|
||||||
@@ -1049,8 +1072,9 @@ function generic_REST_PUT(model)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function generic_REST_DELETE(model)
|
function generic_REST_DELETE(model, gparams)
|
||||||
{
|
{
|
||||||
|
gparams = gparams || {};
|
||||||
var autparams = user.checkAutorisation(model.autfunction, true);
|
var autparams = user.checkAutorisation(model.autfunction, true);
|
||||||
if (!autparams || autparams.PRSwritelevel == 9 || autparams.ALGwritelevel == 9)
|
if (!autparams || autparams.PRSwritelevel == 9 || autparams.ALGwritelevel == 9)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
25
APPL/API2/api_issuedisciplines.asp
Normal file
25
APPL/API2/api_issuedisciplines.asp
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<%@ language = "JavaScript" %>
|
||||||
|
<% /*
|
||||||
|
$Revision$
|
||||||
|
$Id$
|
||||||
|
|
||||||
|
File: api_issuedisciplines.asp
|
||||||
|
|
||||||
|
Description: MLD_DISCIPLINE API
|
||||||
|
Parameters:
|
||||||
|
Context:
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
*/
|
||||||
|
DOCTYPE_Disable = true;
|
||||||
|
ANONYMOUS_Allowed = 1; // Eigenlijk niet waar. We regelen echter alles zelf
|
||||||
|
THIS_FILE = "appl/api/api_issuedisciplines.asp";
|
||||||
|
|
||||||
|
%>
|
||||||
|
<!-- #include file="../Shared/common.inc" -->
|
||||||
|
<!-- #include file="./api2_rest.inc" -->
|
||||||
|
<!-- #include file="../Shared/json2.js" -->
|
||||||
|
<!-- #include file="./model_issuedisciplines.inc" -->
|
||||||
|
<%
|
||||||
|
api2_rest.process(model_issuedisciplines);
|
||||||
|
%>
|
||||||
25
APPL/API2/api_issuetypes.asp
Normal file
25
APPL/API2/api_issuetypes.asp
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<%@ language = "JavaScript" %>
|
||||||
|
<% /*
|
||||||
|
$Revision$
|
||||||
|
$Id$
|
||||||
|
|
||||||
|
File: api_issuetypes.asp
|
||||||
|
|
||||||
|
Description: MLD_STDMELDING API
|
||||||
|
Parameters:
|
||||||
|
Context:
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
*/
|
||||||
|
DOCTYPE_Disable = true;
|
||||||
|
ANONYMOUS_Allowed = 1; // Eigenlijk niet waar. We regelen echter alles zelf
|
||||||
|
THIS_FILE = "appl/api/api_issuetypes.asp";
|
||||||
|
|
||||||
|
%>
|
||||||
|
<!-- #include file="../Shared/common.inc" -->
|
||||||
|
<!-- #include file="./api2_rest.inc" -->
|
||||||
|
<!-- #include file="../Shared/json2.js" -->
|
||||||
|
<!-- #include file="./model_issuetypes.inc" -->
|
||||||
|
<%
|
||||||
|
api2_rest.process(model_issuetypes);
|
||||||
|
%>
|
||||||
@@ -50,7 +50,7 @@ model_appointments =
|
|||||||
},
|
},
|
||||||
list: { columns: ["id", "from", "to"] },
|
list: { columns: ["id", "from", "to"] },
|
||||||
includes: {"visitors": { model: model_visitors,
|
includes: {"visitors": { model: model_visitors,
|
||||||
joinfield: "bez_afspraak_key",
|
joinfield: "appointment",
|
||||||
enable_update: true
|
enable_update: true
|
||||||
},
|
},
|
||||||
"tracking": {
|
"tracking": {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ function model_custom_fields(formodel, flexModule, flexParams)
|
|||||||
flexParams = flexParams || {};
|
flexParams = flexParams || {};
|
||||||
this.module = flexModule;
|
this.module = flexModule;
|
||||||
this.table = "flex";
|
this.table = "flex";
|
||||||
this.primary = "flexparentkey";
|
this.primary = "kenmerk_key";
|
||||||
this.records_name = "custom_fields";
|
this.records_name = "custom_fields";
|
||||||
this.record_name = "custom_field";
|
this.record_name = "custom_field";
|
||||||
// this.records_title = L("lcl_orders");
|
// this.records_title = L("lcl_orders");
|
||||||
@@ -32,12 +32,15 @@ function model_custom_fields(formodel, flexModule, flexParams)
|
|||||||
this.tablesql = "(" + theSqlFlex + ") flex"
|
this.tablesql = "(" + theSqlFlex + ") flex"
|
||||||
|
|
||||||
this.fields =
|
this.fields =
|
||||||
{ "id": { dbs: "kenmerk_key", typ: "key" },
|
{ "id": { dbs: "kenmerk_key", typ: "key" }, // TODO: dit klopt niet helemaal. De echte unieke waarde is bez_kenmerkwaarde_key
|
||||||
"pid": { dbs: "flexparentkey", typ: "key" },
|
"value": { dbs: "waarde", typ: "varchar" },
|
||||||
"value": { dbs: "waarde", typ: "varchar" },
|
"type": { dbs: "kenmerktype", typ: "varchar" },
|
||||||
"type": { dbs: "kenmerktype", typ: "varchar" },
|
"sequence": { dbs: "volgnummer", typ: "number" },
|
||||||
"sequence": { dbs: "volgnummer", typ: "number" },
|
"label": { dbs: "omschrijving", typ: "varchar" },
|
||||||
"label": { dbs: "omschrijving", typ: "varchar" }
|
"flexparentkey": { dbs: "flexparentkey", typ: "key" },
|
||||||
|
// TODO: record.flexparentid wordt er uitgestript vanwege niet teruglinken naar de parent
|
||||||
|
// we hebben hem echter wel nodig. Dit moet beter....
|
||||||
|
"xflexparentkey": { dbs: "xflexparentkey", typ: "key", sql: "flexparentkey" }
|
||||||
};
|
};
|
||||||
// Deze functie wordt na de GET aangeroepen. De bijlagen zijn zo afwijkend
|
// Deze functie wordt na de GET aangeroepen. De bijlagen zijn zo afwijkend
|
||||||
// dat ik dat niet fatsoenlijk in 'fields' verwerkt kreeg
|
// dat ik dat niet fatsoenlijk in 'fields' verwerkt kreeg
|
||||||
@@ -45,7 +48,8 @@ function model_custom_fields(formodel, flexModule, flexParams)
|
|||||||
{
|
{
|
||||||
if (record.type == 'F' || record.type == 'M')
|
if (record.type == 'F' || record.type == 'M')
|
||||||
{
|
{
|
||||||
var flexparam = flexProps(flexModule, record.pid, String(record.id), flexParams.pNiveau, { getFiles: true, api2name: formodel.records_name });
|
var flexparam = flexProps(flexModule, record.xflexparentkey, String(record.id), flexParams.pNiveau,
|
||||||
|
{ getFiles: true, api2name: formodel.records_name });
|
||||||
record.attachments = [];
|
record.attachments = [];
|
||||||
for (var f in flexparam.files)
|
for (var f in flexparam.files)
|
||||||
{
|
{
|
||||||
@@ -57,6 +61,7 @@ function model_custom_fields(formodel, flexModule, flexParams)
|
|||||||
digest: file.digest })
|
digest: file.digest })
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
delete record["xflexparentkey"]; // nu niet meer nodig
|
||||||
}
|
}
|
||||||
this.streamattachment = function(filter, flexfields)
|
this.streamattachment = function(filter, flexfields)
|
||||||
{
|
{
|
||||||
@@ -85,6 +90,12 @@ function model_custom_fields(formodel, flexModule, flexParams)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.list = { columns: ["id", "label", "value"] },
|
||||||
|
// TODO: Hoe controleren dat ik wel rechten heb op deze tracking?
|
||||||
|
this.autfunction = "WEB_RESUSE"; // valsspelen TODO
|
||||||
|
this.REST_GET = generic_REST_GET(this, {});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_custom_field(jsondata, kenmerk_key, val)
|
function set_custom_field(jsondata, kenmerk_key, val)
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ model_districts =
|
|||||||
primary: "alg_district_key",
|
primary: "alg_district_key",
|
||||||
records_name: "districts",
|
records_name: "districts",
|
||||||
record_name: "district",
|
record_name: "district",
|
||||||
parent_key: "alg_regio_key",
|
|
||||||
fields: {"id" : { dbs: "alg_district_key", typ: "key", label: "Key", filter: "exact" },
|
fields: {"id" : { dbs: "alg_district_key", typ: "key", label: "Key", filter: "exact" },
|
||||||
"name" : { dbs: "alg_district_omschrijving", typ: "varchar", label: L("lcl_district")},
|
"name" : { dbs: "alg_district_omschrijving", typ: "varchar", label: L("lcl_district")},
|
||||||
"region": { dbs: "alg_regio_key", typ: "key", foreign: "alg_regio"}
|
"region": { dbs: "alg_regio_key", typ: "key", foreign: "alg_regio"}
|
||||||
@@ -42,7 +41,7 @@ model_districts =
|
|||||||
var sql = "SELECT " + query.selects.join(", ")
|
var sql = "SELECT " + query.selects.join(", ")
|
||||||
+ " FROM " + query.tables.join(", ")
|
+ " FROM " + query.tables.join(", ")
|
||||||
+ " WHERE " + query.wheres.join(" AND " )
|
+ " WHERE " + query.wheres.join(" AND " )
|
||||||
+ " ORDER BY alg_district_omschrijving";
|
+ " ORDER BY alg_district_key, alg_district_omschrijving";
|
||||||
|
|
||||||
var json = api2.sql2json (params, sql, model_districts);
|
var json = api2.sql2json (params, sql, model_districts);
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ model_invoicelines =
|
|||||||
"vat" : { dbs: "fin_factuurregel_btw", typ: "float", track: true, label: L("lcl_fin_total_sum_inBTW") },
|
"vat" : { dbs: "fin_factuurregel_btw", typ: "float", track: true, label: L("lcl_fin_total_sum_inBTW") },
|
||||||
"reference": { dbs: "fin_factuurregel_referentie", typ: "varchar", track: true, label: L("lcl_fin_referencecode"), filter: "like" },
|
"reference": { dbs: "fin_factuurregel_referentie", typ: "varchar", track: true, label: L("lcl_fin_referencecode"), filter: "like" },
|
||||||
"vatvalue" : { dbs: "fin_btwtabelwaarde_key", typ: "key", foreign: "fin_btwtabelwaarde", track: true, label: L("lcl_fin_btwtarief"), filter: "exact" },
|
"vatvalue" : { dbs: "fin_btwtabelwaarde_key", typ: "key", foreign: "fin_btwtabelwaarde", track: true, label: L("lcl_fin_btwtarief"), filter: "exact" },
|
||||||
"costtype" : { dbs: "prs_kostensoort_key", typ: "key", foreign: "prs_kostensoort", track: true, label: L("lcl_shared_charge_type"), filter: "exact" }
|
"costtype" : { dbs: "prs_kostensoort_key", typ: "key", foreign: "prs_kostensoort", track: true, label: L("lcl_shared_charge_type"), filter: "exact" },
|
||||||
// niet terug linken{ name: "factuur", dbs: "fin_factuur_key", typ: "key", foreign: "fac_factuur", filter: "exact" }
|
"fin_factuur_key": { dbs: "fin_factuur_key", typ: "key", filter: "exact" }
|
||||||
},
|
},
|
||||||
|
|
||||||
_pre_analyze_fields: function (params, jsondata) /* analyseer inkomende jsondata, common voor PUT en POST */
|
_pre_analyze_fields: function (params, jsondata) /* analyseer inkomende jsondata, common voor PUT en POST */
|
||||||
|
|||||||
174
APPL/API2/model_issuedisciplines.inc
Normal file
174
APPL/API2/model_issuedisciplines.inc
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
<% /*
|
||||||
|
$Revision$
|
||||||
|
$Id$
|
||||||
|
|
||||||
|
File: model_issuedisciplines.inc
|
||||||
|
|
||||||
|
Description: Vanuit CodeCharge gegenereerd model voor mld_discipline
|
||||||
|
|
||||||
|
Context:
|
||||||
|
|
||||||
|
Notes: TODO: De mld_disc_params er ook bij natuurlijk
|
||||||
|
*/
|
||||||
|
%>
|
||||||
|
<!-- xx#xxinclude file="model_child.inc" -->
|
||||||
|
<%
|
||||||
|
|
||||||
|
model_issuedisciplines =
|
||||||
|
{
|
||||||
|
"table": "ins_tab_discipline",
|
||||||
|
"primary": "ins_discipline_key",
|
||||||
|
"records_name": "issuedisciplines",
|
||||||
|
"record_name": "issuediscipline",
|
||||||
|
"fields": {
|
||||||
|
"id": {
|
||||||
|
"dbs": "ins_discipline_key",
|
||||||
|
"label": "Key",
|
||||||
|
"typ": "key",
|
||||||
|
"filter": "exact",
|
||||||
|
"seq": "ins_s_ins_discipline_key"
|
||||||
|
},
|
||||||
|
"disciplinetype": {
|
||||||
|
"dbs": "ins_srtdiscipline_key",
|
||||||
|
"label": L("ins_srtdiscipline_key"),
|
||||||
|
"typ": "key",
|
||||||
|
"comment": "Pas op: lookupSQL is dynamisch: \"&sqlINS_SRTDISCIPLINE_KEY&\"",
|
||||||
|
"foreign" : {
|
||||||
|
"tbl": "ins_srtdiscipline",
|
||||||
|
"key": "ins_srtdiscipline_key",
|
||||||
|
"desc": "ins_srtdiscipline_omschrijving"
|
||||||
|
},
|
||||||
|
"filter": "like",
|
||||||
|
label: L("lcl_mld_categorie")
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"dbs": "ins_discipline_omschrijving",
|
||||||
|
"label": L("ins_discipline_omschrijving"),
|
||||||
|
"typ": "memo",
|
||||||
|
"translate": true
|
||||||
|
},
|
||||||
|
"costtype": {
|
||||||
|
"dbs": "prs_kostensoort_key",
|
||||||
|
"label": L("prs_kostensoort_key"),
|
||||||
|
"typ": "key",
|
||||||
|
"foreign": {
|
||||||
|
"tbl": "PRS_KOSTENSOORT",
|
||||||
|
"key": "PRS_KOSTENSOORT_KEY",
|
||||||
|
"desc": "PRS_KOSTENSOORT_OMS"
|
||||||
|
},
|
||||||
|
"LOVinit": ""
|
||||||
|
},
|
||||||
|
"ins_discipline_kpnverplicht": {
|
||||||
|
"dbs": "ins_discipline_kpnverplicht",
|
||||||
|
"label": L("ins_discipline_kpnverplicht"),
|
||||||
|
"typ": "check"
|
||||||
|
},
|
||||||
|
"ins_discipline_module": {
|
||||||
|
"dbs": "ins_discipline_module",
|
||||||
|
"label": L("ins_discipline_module"),
|
||||||
|
"typ": "memo"
|
||||||
|
},
|
||||||
|
"ins_discipline_email": {
|
||||||
|
"dbs": "ins_discipline_email",
|
||||||
|
"label": L("ins_discipline_email"),
|
||||||
|
"typ": "memo"
|
||||||
|
},
|
||||||
|
"ins_discipline_ktopercentage": {
|
||||||
|
"dbs": "ins_discipline_ktopercentage",
|
||||||
|
"label": L("ins_discipline_ktopercentage"),
|
||||||
|
"typ": "number"
|
||||||
|
},
|
||||||
|
"ins_discipline_ktodrempel": {
|
||||||
|
"dbs": "ins_discipline_ktodrempel",
|
||||||
|
"label": L("ins_discipline_ktodrempel"),
|
||||||
|
"typ": "number"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"list": {
|
||||||
|
"columns": [
|
||||||
|
"id",
|
||||||
|
"name",
|
||||||
|
"costtype",
|
||||||
|
"disciplinetype"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"search": {
|
||||||
|
"autosearch": true,
|
||||||
|
"filters": ["disciplinetype"]
|
||||||
|
},
|
||||||
|
"autfunction": "WEB_MLDMGT",
|
||||||
|
"record_title": L("ins_tab_discipline"),
|
||||||
|
"records_title": L("ins_tab_discipline_m")
|
||||||
|
}
|
||||||
|
|
||||||
|
api2.generic_REST(model_issuedisciplines, { GET: { wheres: [ " ins_discipline_module = 'MLD'" ] } });
|
||||||
|
|
||||||
|
/*
|
||||||
|
FACXSL_LCL('ins_srtdiscipline_key', 'Vakgroeptype', 'Discipline type', 'Innendiensttyp', 'Type de groupe de service')
|
||||||
|
FACXSL_LCL('ins_discipline_omschrijving', 'Omschrijving', 'Description', 'Umschreibung', 'Description')
|
||||||
|
FACXSL_LCL('prs_kostensoort_key', 'Kostensoort', 'Cost category', 'Kostenart', 'Type de co<63>ts')
|
||||||
|
FACXSL_LCL('ins_discipline_kpnverplicht', 'Kostenplaats verplicht', 'Cost centre required', 'Kostenstelle erfordlich', 'Centre de co<63>ts obligatoire')
|
||||||
|
FACXSL_LCL('ins_discipline_module', 'INS_DISCIPLINE_MODULE', '@@', '@@', '@@')
|
||||||
|
FACXSL_LCL('ins_discipline_email', 'E-mail afzender notificaties', 'E-mail sender notifications', 'E-mail Absender Notifikationen', 'Exp<78>diteur e-mail des notifications')
|
||||||
|
FACXSL_LCL('ins_discipline_ktopercentage', 'Klanttevredenheidsmeting percentage', 'Customer satisfaction survey %', 'Befragung zur Kundenzufriedenheit %', 'Enqu<71>te')
|
||||||
|
FACXSL_LCL('ins_discipline_ktodrempel', 'Klanttevredenheidsmeting drempel', 'Customer satisfaction survey threshold', 'Befragung zur Kundenzufriedenheit Schwelle', 'Seuil d''enqu<71>te')
|
||||||
|
FACXSL_LCL('ins_tab_discipline', 'Vakgroep', 'Discipline', 'Innendienst', 'Groupe de service')
|
||||||
|
FACXSL_LCL('ins_tab_discipline_m', 'Vakgroepen', '@@', '@@', '@@')
|
||||||
|
|
||||||
|
----------------------------
|
||||||
|
Page event show:
|
||||||
|
'Zoek het vakgroeptype op
|
||||||
|
|
||||||
|
if fldINS_SRTDISCIPLINE_KEY <> "" then
|
||||||
|
sqlOmschrijving = "select ins_srtdiscipline_omschrijving "&_
|
||||||
|
"from ins_srtdiscipline "&_
|
||||||
|
"where ins_srtdiscipline_key = " & ToSQL(fldINS_SRTDISCIPLINE_KEY, "Number")
|
||||||
|
openrs rsOmschrijving, sqlOmschrijving
|
||||||
|
if not rsOmschrijving.EOF then
|
||||||
|
fldINS_SRTDISCIPLINE_KEY = getValue(rsOmschrijving,"ins_srtdiscipline_omschrijving")
|
||||||
|
end if
|
||||||
|
rsOmschrijving.Close
|
||||||
|
end if
|
||||||
|
|
||||||
|
----------------------------
|
||||||
|
Page event open:
|
||||||
|
tmpWhere = ""
|
||||||
|
pINS_DISCIPLINE_OMSCHRIJVING = getParam("sINS_DISCIPLINE_OMSCHRIJVING")
|
||||||
|
if not isEmpty(pINS_DISCIPLINE_OMSCHRIJVING) then
|
||||||
|
hasParam = true
|
||||||
|
tmpWhere = tmpWhere & " Upper(INS_DISCIPLINE_OMSCHRIJVING) like '%" & UCase(replace(pINS_DISCIPLINE_OMSCHRIJVING,"'","''")) & "%'"
|
||||||
|
end if
|
||||||
|
|
||||||
|
if tmpWhere <> "" then
|
||||||
|
sSQL = sSQL & " AND (" & tmpWhere & ")"
|
||||||
|
end if
|
||||||
|
|
||||||
|
----------------------------
|
||||||
|
Form event show:
|
||||||
|
'Zoek het vakgroeptype op
|
||||||
|
|
||||||
|
if fldINS_SRTDISCIPLINE_KEY <> "" then
|
||||||
|
sqlOmschrijving = "select ins_srtdiscipline_omschrijving "&_
|
||||||
|
"from ins_srtdiscipline "&_
|
||||||
|
"where ins_srtdiscipline_key = " & ToSQL(fldINS_SRTDISCIPLINE_KEY, "Number")
|
||||||
|
openrs rsOmschrijving, sqlOmschrijving
|
||||||
|
if not rsOmschrijving.EOF then
|
||||||
|
fldINS_SRTDISCIPLINE_KEY = getValue(rsOmschrijving,"ins_srtdiscipline_omschrijving")
|
||||||
|
end if
|
||||||
|
rsOmschrijving.Close
|
||||||
|
end if
|
||||||
|
|
||||||
|
----------------------------
|
||||||
|
Form event open:
|
||||||
|
tmpWhere = ""
|
||||||
|
pINS_DISCIPLINE_OMSCHRIJVING = getParam("sINS_DISCIPLINE_OMSCHRIJVING")
|
||||||
|
if not isEmpty(pINS_DISCIPLINE_OMSCHRIJVING) then
|
||||||
|
hasParam = true
|
||||||
|
tmpWhere = tmpWhere & " Upper(INS_DISCIPLINE_OMSCHRIJVING) like '%" & UCase(replace(pINS_DISCIPLINE_OMSCHRIJVING,"'","''")) & "%'"
|
||||||
|
end if
|
||||||
|
|
||||||
|
if tmpWhere <> "" then
|
||||||
|
sSQL = sSQL & " AND (" & tmpWhere & ")"
|
||||||
|
end if
|
||||||
|
*/
|
||||||
|
%>
|
||||||
@@ -17,11 +17,11 @@ model_issueobjects =
|
|||||||
primary: "mld_melding_object_key",
|
primary: "mld_melding_object_key",
|
||||||
records_name: "issueobjects",
|
records_name: "issueobjects",
|
||||||
record_name: "issueobject",
|
record_name: "issueobject",
|
||||||
fields: {"id" : { dbs: "mld_melding_object_key", typ: "key", filter: "exact" },
|
fields: {"id" : { dbs: "mld_melding_object_key", typ: "key", filter: "exact" },
|
||||||
//"issue": { dbs: "mld_melding_key", typ: "key", xforeign: "mld_melding" }, // niet teruglinken // mld_melding zit niet in save2db.foreignKeyTable()
|
"object" : { dbs: "ins_deel_key", typ: "key", foreign: "ins_deel" },
|
||||||
"object": { dbs: "ins_deel_key", typ: "key", foreign: "ins_deel" }
|
"mld_melding_key": { dbs: "mld_melding_key", typ: "key" }
|
||||||
},
|
},
|
||||||
parent_key: "MLD_MELDING_KEY",
|
|
||||||
list: { columns: ["object"] },
|
list: { columns: ["object"] },
|
||||||
|
|
||||||
_analyze_fields: function (dbfields, params, jsondata) /* analyseer inkomende data, common voor PUT en POST */
|
_analyze_fields: function (dbfields, params, jsondata) /* analyseer inkomende data, common voor PUT en POST */
|
||||||
|
|||||||
@@ -69,17 +69,12 @@ function model_issues(mld_key, params)
|
|||||||
joinfield: "fac_tracking_refkey"
|
joinfield: "fac_tracking_refkey"
|
||||||
},
|
},
|
||||||
"notes": {
|
"notes": {
|
||||||
model: model_notes,
|
model: new model_notes("MLD"),
|
||||||
joinfield: "parent_key",
|
joinfield: "parent"
|
||||||
joinfunction: function (params)
|
|
||||||
{
|
|
||||||
/* gaat uit dat die wordt geimplementeerd met een view fac_v_notes (module, key, columns....) */
|
|
||||||
return "(module='MLD' OR module IS NULL) AND fac_v_notes.parent_key(+) = mld_melding.mld_melding_key";
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"orders": {
|
"orders": {
|
||||||
model: new model_orders(),
|
model: new model_orders(),
|
||||||
joinfield: "mld_melding_key"
|
joinfield: "issue"
|
||||||
},
|
},
|
||||||
"custom_fields" : { model: new model_custom_fields(this, "MLD", { pNiveau: "M", readman: true, readuse: true }),
|
"custom_fields" : { model: new model_custom_fields(this, "MLD", { pNiveau: "M", readman: true, readuse: true }),
|
||||||
joinfield: "flexparentkey"
|
joinfield: "flexparentkey"
|
||||||
@@ -189,79 +184,8 @@ function model_issues(mld_key, params)
|
|||||||
function _pre_analyze_fields (params, jsondata) /* analyseer inkomende jsondata voor POST */
|
function _pre_analyze_fields (params, jsondata) /* analyseer inkomende jsondata voor POST */
|
||||||
{
|
{
|
||||||
params.data = {};
|
params.data = {};
|
||||||
var issuetype = api2.get_jdata_refkey(jsondata.issuetype);
|
|
||||||
var account = api2.get_jdata_refkey(jsondata.account);
|
|
||||||
var mld_key = jsondata.id;
|
var mld_key = jsondata.id;
|
||||||
|
|
||||||
if (params.isNew)
|
|
||||||
{ // analyseer inkomende jsondata voor POST
|
|
||||||
var msgError = "";
|
|
||||||
var hasError = true;
|
|
||||||
//
|
|
||||||
// Voor een nieuwe melding moet er een geldige stdmelding zijn.
|
|
||||||
msgError = "Missing issuetype";
|
|
||||||
if (jsondata.issuetype)
|
|
||||||
{
|
|
||||||
msgError = "Invalid issuetype";
|
|
||||||
var sql_stdm = "SELECT sm.mld_stdmelding_omschrijving"
|
|
||||||
+ " , sm.mld_ins_discipline_key"
|
|
||||||
+ " , md.ins_srtdiscipline_key"
|
|
||||||
+ " , COALESCE(sm.mld_stdmelding_directklaar, dp.mld_disc_params_directklaar, 0) mld_directklaar"
|
|
||||||
+ " FROM mld_stdmelding sm"
|
|
||||||
+ " , mld_discipline md"
|
|
||||||
+ " , mld_disc_params dp"
|
|
||||||
+ " WHERE sm.mld_ins_discipline_key = md.ins_discipline_key"
|
|
||||||
+ " AND sm.mld_ins_discipline_key = dp.mld_ins_discipline_key"
|
|
||||||
+ " AND sm.mld_stdmelding_key = " + issuetype;
|
|
||||||
|
|
||||||
var oRs_stdm = Oracle.Execute(sql_stdm);
|
|
||||||
if (!oRs_stdm.eof)
|
|
||||||
{
|
|
||||||
params.data.mld_ins_discipline_key = oRs_stdm("mld_ins_discipline_key").Value;
|
|
||||||
params.data.ins_srtdiscipline_key = oRs_stdm("ins_srtdiscipline_key").Value;
|
|
||||||
params.data.mld_directklaar = oRs_stdm("mld_directklaar").Value;
|
|
||||||
hasError = false;
|
|
||||||
}
|
|
||||||
oRs_stdm.Close();
|
|
||||||
}
|
|
||||||
if (hasError) api2.error(500, msgError);
|
|
||||||
//
|
|
||||||
|
|
||||||
// Bepaal de kostenplaats, indien verplicht.
|
|
||||||
var stdm_info = mld.mld_stdmeldinginfo(issuetype);
|
|
||||||
var kpkey = (account ? account : -1);
|
|
||||||
if (stdm_info.kpnverplicht && kpkey < 0)
|
|
||||||
{ // Kostenplaats is verplicht, maar is niet meegegeven. Bepaal default kostenplaats.
|
|
||||||
kpkey = (user.afdeling().prs_kostenplaats_key() || -1); // User kostenplaats key
|
|
||||||
}
|
|
||||||
if (stdm_info.kpnverplicht && kpkey < 0)
|
|
||||||
{ // Kon ook geen default kostenplaats vinden.
|
|
||||||
msgError = "Account could not be validated";
|
|
||||||
api2.error(500, msgError);
|
|
||||||
}
|
|
||||||
jsondata.account = kpkey;
|
|
||||||
params.data.is_kto_antwoord = stdm_info.is_kto_antwoord;
|
|
||||||
//
|
|
||||||
|
|
||||||
//
|
|
||||||
if (!jsondata.contact) jsondata.contact = user_key; // Als er geen aanvrager opgegeven is, dan de huidige gebruiker invullen.
|
|
||||||
// Als de setting niet is gezet is "Melding voor" gelijk aan contactpersoon.
|
|
||||||
if (S("mld_allow_for_others") == 0)
|
|
||||||
{
|
|
||||||
jsondata.requestor = jsondata.contact;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Bestaande melding: Haal de gegevens op.
|
|
||||||
var sql = "SELECT mld_stdmelding_key"
|
|
||||||
+ " FROM mld_melding"
|
|
||||||
+ " WHERE mld_melding_key = " + mld_key;
|
|
||||||
var oRs = Oracle.Execute(sql);
|
|
||||||
jsondata.issuetype = oRs("mld_stdmelding_key").Value;
|
|
||||||
oRs.Close();
|
|
||||||
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
var stdm_info = mld.mld_stdmeldinginfo(jsondata.issuetype);
|
var stdm_info = mld.mld_stdmeldinginfo(jsondata.issuetype);
|
||||||
@@ -345,15 +269,6 @@ function model_issues(mld_key, params)
|
|||||||
alg_onroerendgoed_keys = gebouwkey;
|
alg_onroerendgoed_keys = gebouwkey;
|
||||||
}
|
}
|
||||||
params.data.alg_onroerendgoed_keys = alg_onroerendgoed_keys;
|
params.data.alg_onroerendgoed_keys = alg_onroerendgoed_keys;
|
||||||
|
|
||||||
if (!params.isNew)
|
|
||||||
{ // Verwijder voor PUT wat niet gewijzigd mag worden.
|
|
||||||
delete jsondata.name;
|
|
||||||
delete jsondata.contact;
|
|
||||||
delete jsondata.requestor;
|
|
||||||
delete jsondata.issuetype;
|
|
||||||
delete jsondata.location;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function _analyze_fields (dbfields, params, jsondata) /* analyseer inkomende data, common voor PUT en POST */
|
function _analyze_fields (dbfields, params, jsondata) /* analyseer inkomende data, common voor PUT en POST */
|
||||||
@@ -421,24 +336,35 @@ function model_issues(mld_key, params)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msgError = "Issue can not be closed";
|
api2.error(500, "Issue can not be closed");
|
||||||
api2.error(500, msgError);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.REST_PUT = function (params, jsondata, the_key) /* update issue */
|
this.REST_PUT = function (params, jsondata, the_key) /* update issue */
|
||||||
{
|
{
|
||||||
if (jsondata[this.record_name])
|
|
||||||
jsondata = jsondata[this.record_name]; // dereference
|
|
||||||
|
|
||||||
if (!jsondata.id) jsondata.id = the_key;
|
if (!jsondata.id) jsondata.id = the_key;
|
||||||
|
|
||||||
var mld_key = the_key;
|
var mld_key = jsondata.id;
|
||||||
var old_mld = new model_issues(mld_key);
|
|
||||||
|
// Vul jsondata aan met actuele 'oude' data
|
||||||
|
var old_mld = new model_issues(mld_key).data;
|
||||||
|
for (var fld in old_mld)
|
||||||
|
{
|
||||||
|
if (!(fld in jsondata))
|
||||||
|
jsondata[fld] = old_mld[fld];
|
||||||
|
}
|
||||||
|
api2.cleanup_data(this, jsondata); // Doet een generieke dereference van alle foreign's
|
||||||
|
|
||||||
var this_mld = mld.func_enabled_melding(mld_key);
|
var this_mld = mld.func_enabled_melding(mld_key);
|
||||||
user.auth_required_or_abort(this_mld.canChange); // Geen wijzigingen toestaan bij onvoldoende rechten.
|
user.auth_required_or_abort(this_mld.canChange); // Geen wijzigingen toestaan bij onvoldoende rechten.
|
||||||
|
|
||||||
_pre_analyze_fields(params, jsondata);
|
_pre_analyze_fields(params, jsondata);
|
||||||
|
// Verwijder voor PUT wat niet gewijzigd mag worden.
|
||||||
|
delete jsondata.name;
|
||||||
|
delete jsondata.contact;
|
||||||
|
delete jsondata.requestor;
|
||||||
|
delete jsondata.issuetype;
|
||||||
|
delete jsondata.location;
|
||||||
|
|
||||||
var dbfields = api2.update_fields(params, this, jsondata); // Build updater
|
var dbfields = api2.update_fields(params, this, jsondata); // Build updater
|
||||||
_analyze_fields(dbfields, params, jsondata);
|
_analyze_fields(dbfields, params, jsondata);
|
||||||
_validate_fields(dbfields, params, jsondata);
|
_validate_fields(dbfields, params, jsondata);
|
||||||
@@ -450,54 +376,76 @@ function model_issues(mld_key, params)
|
|||||||
if (err.friendlyMsg)
|
if (err.friendlyMsg)
|
||||||
abort_with_warning(err.friendlyMsg);
|
abort_with_warning(err.friendlyMsg);
|
||||||
|
|
||||||
params.data.module = "MLD"; // model_notes moet weten bij wekle module de notes horen.
|
|
||||||
var mldtrack = api2.process_includes(params, this, jsondata, mld_key);
|
var mldtrack = api2.process_includes(params, this, jsondata, mld_key);
|
||||||
|
|
||||||
shared.trackaction("MLDUPD",
|
shared.trackaction("MLDUPD",
|
||||||
mld_key,
|
mld_key,
|
||||||
L("lcl_mld_is_mldupdtrack").format(mld_key) + (mldUpd.trackarray.length > 0? "\n" : "") + mldUpd.trackarray.join("\n"));
|
L("lcl_mld_is_mldupdtrack").format(mld_key) + (mldUpd.trackarray.length > 0? "\n" : "") + mldUpd.trackarray.join("\n"));
|
||||||
|
|
||||||
status = jsondata["status"].id;
|
if (jsondata.status > 0)
|
||||||
if (status > 0)
|
mld.setmeldingstatus(mld_key, jsondata.status, "");
|
||||||
mld.setmeldingstatus(mld_key, status, "");
|
|
||||||
|
|
||||||
return { key: mld_key };
|
return { key: mld_key };
|
||||||
};
|
};
|
||||||
|
|
||||||
this.REST_POST = function (params, jsondata) /* new call */
|
this.REST_POST = function (params, jsondata) /* new call */
|
||||||
{
|
{
|
||||||
if (jsondata[this.record_name])
|
api2.cleanup_data(this, jsondata); // Doet een generieke dereference van alle foreign's
|
||||||
jsondata = jsondata[this.record_name]; // dereference
|
|
||||||
|
//
|
||||||
|
// Voor een nieuwe melding moet er een geldige stdmelding zijn.
|
||||||
|
if (!jsondata.issuetype)
|
||||||
|
api2.error(500, "Missing issuetype")
|
||||||
|
|
||||||
|
var stdm = new model_issuetypes(jsondata.issuetype).data;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bepaal de kostenplaats, indien verplicht.
|
||||||
|
var stdm_info = mld.mld_stdmeldinginfo(jsondata.issuetype);
|
||||||
|
var kpkey = (jsondata.account ? jsondata.account : -1);
|
||||||
|
if (stdm_info.kpnverplicht && kpkey < 0)
|
||||||
|
{ // Kostenplaats is verplicht, maar is niet meegegeven. Bepaal default kostenplaats.
|
||||||
|
kpkey = (user.afdeling().prs_kostenplaats_key() || -1); // User kostenplaats key
|
||||||
|
}
|
||||||
|
if (stdm_info.kpnverplicht && kpkey < 0)
|
||||||
|
{ // Kon ook geen default kostenplaats vinden.
|
||||||
|
api2.error(500, "Account could not be validated");
|
||||||
|
}
|
||||||
|
jsondata.account = kpkey;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!jsondata.contact) jsondata.contact = user_key; // Als er geen aanvrager opgegeven is, dan de huidige gebruiker invullen.
|
||||||
|
// Als de setting niet is gezet is "Melding voor" gelijk aan contactpersoon.
|
||||||
|
if (S("mld_allow_for_others") == 0)
|
||||||
|
{
|
||||||
|
jsondata.requestor = jsondata.contact;
|
||||||
|
}
|
||||||
|
|
||||||
params.isNew = true;
|
params.isNew = true;
|
||||||
_pre_analyze_fields(params, jsondata);
|
_pre_analyze_fields(params, jsondata);
|
||||||
|
|
||||||
var this_mld = mld.func_enabled_mld(params.data.mld_ins_discipline_key, "D");
|
var this_mld = mld.func_enabled_mld(stdm.discipline.id, "D");
|
||||||
user.auth_required_or_abort(this_mld.canFEwrite || this_mld.canFOwrite);
|
user.auth_required_or_abort(this_mld.canFEwrite || this_mld.canFOwrite);
|
||||||
//
|
//
|
||||||
var dbfields = api2.update_fields(params, this, jsondata); // Build updater
|
var dbfields = api2.update_fields(params, this, jsondata); // Build updater
|
||||||
_analyze_fields(dbfields, params, jsondata);
|
_analyze_fields(dbfields, params, jsondata);
|
||||||
_validate_fields(dbfields, params, jsondata);
|
_validate_fields(dbfields, params, jsondata);
|
||||||
|
|
||||||
dbfields["alg"] = { dbs: "mld_alg_onroerendgoed_keys", typ: "key", val: (params.data.alg_onroerendgoed_keys==-1 ? null : params.data.alg_onroerendgoed_keys) };
|
dbfields["alg"] = { dbs: "mld_alg_onroerendgoed_keys", typ: "key", val: (params.data.alg_onroerendgoed_keys==-1 ? null : params.data.alg_onroerendgoed_keys) };
|
||||||
dbfields["origin"] = { dbs: "mld_meldbron_key", typ: "key", val: S("mld_meldbron_key") };
|
dbfields["origin"] = { dbs: "mld_meldbron_key", typ: "key", val: S("mld_meldbron_key") };
|
||||||
dbfields["module"] = { dbs: "mld_melding_module", typ: "varchar", val: "MLD" };
|
dbfields["module"] = { dbs: "mld_melding_module", typ: "varchar", val: "MLD" };
|
||||||
dbfields["issue"] = { dbs: "mld_melding_key", typ: "key", seq: "mld_s_mld_melding_key" };
|
dbfields["issue"] = { dbs: "mld_melding_key", typ: "key", seq: "mld_s_mld_melding_key" };
|
||||||
|
|
||||||
var mldIns = buildInsert("mld_melding", dbfields, { noValidateToken: true });
|
var mldIns = buildInsert("mld_melding", dbfields, { noValidateToken: true });
|
||||||
var new_key = mldIns.sequences["mld_melding_key"];
|
var new_key = mldIns.sequences["mld_melding_key"];
|
||||||
var sql = "BEGIN "
|
var sql = mldIns.sql;
|
||||||
+ mldIns.sql + ";"
|
|
||||||
+ "END;";
|
|
||||||
Oracle.Execute(mldIns.sql);
|
Oracle.Execute(mldIns.sql);
|
||||||
|
|
||||||
mld.setmeldingstatus(new_key, (params.data.mld_directklaar? 0 : 2)); // Zorgt ook voor tracking & daarmee notificatie
|
mld.setmeldingstatus(new_key, (stdm.xmld_directklaar? 0 : 2)); // Zorgt ook voor tracking & daarmee notificatie
|
||||||
|
|
||||||
if (params.data.is_kto_antwoord) // die direct afmelden
|
if (stdm_info.xis_kto_answer) // die direct afmelden
|
||||||
mld.setmeldingstatus(new_key, 5);
|
mld.setmeldingstatus(new_key, 5);
|
||||||
|
|
||||||
params.data.module = "MLD"; // model_notes moet weten bij wekle module de notes horen.
|
|
||||||
|
|
||||||
return { key: new_key };
|
return { key: new_key };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -8,81 +8,104 @@
|
|||||||
|
|
||||||
Context:
|
Context:
|
||||||
|
|
||||||
Notes:
|
Notes: Normaal gesproken krijg je bij een foreign alleen de id en de de name
|
||||||
|
Voor discipline maken we hier echter een uitzondering: in de praktijk
|
||||||
|
heb je de info daarvan er eigenlijk altijd ook wel bij nodig
|
||||||
*/
|
*/
|
||||||
%>
|
%>
|
||||||
|
<!-- #include file="./model_issuedisciplines.inc" -->
|
||||||
<%
|
<%
|
||||||
function model_issuetypes(stdm_key, params)
|
function model_issuetypes(stdm_key, params)
|
||||||
{
|
{
|
||||||
this.table = "mld_stdmelding";
|
params = params || {};
|
||||||
this.primary = "mld_stdmelding_key";
|
this.table = "mld_stdmelding";
|
||||||
this.records_name = "issuetypes";
|
this.primary = "mld_stdmelding_key";
|
||||||
this.record_name = "issuetype";
|
this.records_name = "issuetypes";
|
||||||
this.fields= {
|
this.record_name = "issuetype";
|
||||||
"id": {
|
this.fields = {
|
||||||
"dbs": "mld_stdmelding_key",
|
"id": {
|
||||||
"label": "Key",
|
"dbs": "mld_stdmelding_key",
|
||||||
"typ": "key",
|
"label": "Key",
|
||||||
"filter": "exact",
|
"typ": "key",
|
||||||
"seq": "mld_s_mld_stdmelding_key"
|
"filter": "exact",
|
||||||
},
|
"seq": "mld_s_mld_stdmelding_key"
|
||||||
// Ik kan geen logisch "name" veld bedenken
|
},
|
||||||
discipline: { dbs: "mld_ins_discipline_key", typ: "key", "foreign": "MLD_DISCIPLINE", label: L("lcl_mld_vakgroep") },
|
// Ik kan geen logisch "name" veld bedenken
|
||||||
description: { dbs: "mld_stdmelding_omschrijving", typ: "varchar", label: L("lcl_mld_inf_Omschrijving") },
|
discipline: { dbs: "mld_ins_discipline_key", typ: "key", "foreign": "MLD_DISCIPLINE", label: L("lcl_mld_vakgroep") },
|
||||||
// { dbs: "mld_stdmelding_notfrontend", typ: "check0", frm: "notfrontend" },
|
description: { dbs: "mld_stdmelding_omschrijving", typ: "varchar", label: L("lcl_mld_inf_Omschrijving") },
|
||||||
costtype: { dbs: "prs_kostensoort_key", typ: "key", foreign: "prs_kostensoort", track: true, label: L("lcl_shared_charge_type"), filter: "exact" },
|
// { dbs: "mld_stdmelding_notfrontend", typ: "check0", frm: "notfrontend" },
|
||||||
// { dbs: "alg_onrgoed_niveau", typ: "varchar", frm: "onrgoed_niveau" },
|
costtype: { dbs: "prs_kostensoort_key", typ: "key", foreign: "prs_kostensoort", label: L("lcl_shared_charge_type"), filter: "exact" },
|
||||||
// { dbs: "mld_stdmelding_notify", typ: "check0", frm: "notify" },
|
// { dbs: "alg_onrgoed_niveau", typ: "varchar", frm: "onrgoed_niveau" },
|
||||||
// { dbs: "mld_stdmelding_planbaar", typ: "check0", frm: "planbaar" },
|
// { dbs: "mld_stdmelding_notify", typ: "check0", frm: "notify" },
|
||||||
// { dbs: "mld_stdmelding_freetext", typ: "key", frm: "freetext" },
|
// { dbs: "mld_stdmelding_planbaar", typ: "check0", frm: "planbaar" },
|
||||||
// { dbs: "ins_srtinst_verplicht", typ: "check0", frm: "obj_verplicht" },
|
// { dbs: "mld_stdmelding_freetext", typ: "key", frm: "freetext" },
|
||||||
// { dbs: "mld_stdmelding_hint", typ: "varchar", frm: "aanwijzing" },
|
// { dbs: "ins_srtinst_verplicht", typ: "check0", frm: "obj_verplicht" },
|
||||||
"autoorder": { dbs: "mld_stdmelding_autoorder", typ: "check0", label: L("lcl_mld_autoorder") },
|
"hint": { dbs: "mld_stdmelding_hint", typ: "varchar", label: L("lcl_mld_hint") },
|
||||||
requireservice: { dbs: "mld_stdmelding_vereisdienst", typ: "check0", label: L("lcl_mld_vereisdienst") },
|
"autoorder": { dbs: "mld_stdmelding_autoorder", typ: "check0", label: L("lcl_mld_autoorder") },
|
||||||
issuegroup: { dbs: "mld_stdmeldinggroep_key", typ: "key", label: L("lcl_mld_meldinggroep") },
|
requireservice: { dbs: "mld_stdmelding_vereisdienst", typ: "check0", label: L("lcl_mld_vereisdienst") },
|
||||||
service: { dbs: "prs_dienst_key", typ: "key", label: L("lcl_mld_behandel_dienst"), foreign: "prs_dienst" },
|
issuegroup: { dbs: "mld_stdmeldinggroep_key", typ: "key", label: L("lcl_mld_meldinggroep") },
|
||||||
ordertype: { dbs: "mld_typeopdr_key", typ: "key", label: L("lcl_mld_typeopdr") }
|
service: { dbs: "prs_dienst_key", typ: "key", label: L("lcl_mld_behandel_dienst"), foreign: "prs_dienst" },
|
||||||
// { dbs: "mld_stdmelding_regime", typ: "key", frm: "regime" },
|
ordertype: { dbs: "mld_typeopdr_key", typ: "key", label: L("lcl_mld_typeopdr") },
|
||||||
// { dbs: "mld_stdmelding_malus", typ: "float", frm: "malus" },
|
// { dbs: "mld_stdmelding_regime", typ: "key", frm: "regime" },
|
||||||
// { dbs: "mld_stdmelding_afhankelijk", typ: "check0", frm: "afhankelijk" },
|
// { dbs: "mld_stdmelding_malus", typ: "float", frm: "malus" },
|
||||||
// { dbs: "mld_stdmelding_image", typ: "varchar", frm: "image" },
|
// { dbs: "mld_stdmelding_afhankelijk", typ: "check0", frm: "afhankelijk" },
|
||||||
// { dbs: "mld_stdmelding_afmeldtext", typ: "key", frm: "afmeldtext" },
|
// { dbs: "mld_stdmelding_image", typ: "varchar", frm: "image" },
|
||||||
// { dbs: "mld_stdmelding_volgnr", typ: "number", frm: "volgnummer" },
|
// { dbs: "mld_stdmelding_afmeldtext", typ: "key", frm: "afmeldtext" },
|
||||||
// { dbs: "mld_stdmelding_prseigen", typ: "check0", frm: "prseigen" },
|
// { dbs: "mld_stdmelding_volgnr", typ: "number", frm: "volgnummer" },
|
||||||
// { dbs: "mld_stdmelding_doublecheck", typ: "key", frm: "doublecheck" },
|
// { dbs: "mld_stdmelding_prseigen", typ: "check0", frm: "prseigen" },
|
||||||
// { dbs: "mld_stdmelding_kopieerbaar", typ: "check0", frm: "kopieerbaar" },
|
// { dbs: "mld_stdmelding_doublecheck", typ: "key", frm: "doublecheck" },
|
||||||
// { dbs: "mld_stdmelding_kto", typ: "key", frm: "kto" },
|
// { dbs: "mld_stdmelding_kopieerbaar", typ: "check0", frm: "kopieerbaar" },
|
||||||
// { dbs: "bes_ins_discipline_key", typ: "key", frm: "bes_disc_key" },
|
// { dbs: "mld_stdmelding_kto", typ: "key", frm: "kto" },
|
||||||
// { dbs: "mld_stdmelding_vervaldatum", typ: "date", frm: "vervaldatum" },
|
// { dbs: "bes_ins_discipline_key", typ: "key", frm: "bes_disc_key" },
|
||||||
// { dbs: "mld_stdmelding_opdrtypevast", typ: "check0", frm: "opdrtypevast" },
|
// { dbs: "mld_stdmelding_vervaldatum", typ: "date", frm: "vervaldatum" },
|
||||||
// { dbs: "mld_stdmelding_directklaar", typ: "key", frm: "directklaar" },
|
// { dbs: "mld_stdmelding_opdrtypevast", typ: "check0", frm: "opdrtypevast" },
|
||||||
// { dbs: "mld_stdmelding_slabewaken", typ: "check0", frm: "slabewaken" },
|
immediateready: { dbs: "mld_stdmelding_directklaar", typ: "key", label: L("lcl_mld_directklaar"), LOV: api2.makeLOV([L("lcl_No"), L("lcl_Yes"), L("lcl_mld_initieel_fo")]) },
|
||||||
// { dbs: "alg_onrgoed_obj_niveau", typ: "varchar", frm: "obj_show_niveau" },
|
ximmediateready: { dbs: "xmld_stdmelding_directklaar", typ: "key", sql: "COALESCE(mld_stdmelding_directklaar, mld_disc_params_directklaar, 0)" }
|
||||||
// { dbs: "alg_org_obj_niveau", typ: "number", frm: "org_obj_niveau" },
|
// { dbs: "mld_stdmelding_slabewaken", typ: "check0", frm: "slabewaken" },
|
||||||
// { dbs: "mld_stdmelding_t_uitvoertijd.tijdsduur",
|
// { dbs: "alg_onrgoed_obj_niveau", typ: "varchar", frm: "obj_show_niveau" },
|
||||||
// obj: "MLD_T_UITVOERTIJD", typ: "float", frm: "uitvoertijd3" },
|
// { dbs: "alg_org_obj_niveau", typ: "number", frm: "org_obj_niveau" },
|
||||||
// { dbs: "mld_stdmelding_t_uitvoertijd.eenheid",
|
// { dbs: "mld_stdmelding_t_uitvoertijd.tijdsduur",
|
||||||
// obj: "MLD_T_UITVOERTIJD", typ: "varchar", frm: "dayshours3" }
|
// obj: "MLD_T_UITVOERTIJD", typ: "float", frm: "uitvoertijd3" },
|
||||||
}
|
// { dbs: "mld_stdmelding_t_uitvoertijd.eenheid",
|
||||||
this.list = {
|
// obj: "MLD_T_UITVOERTIJD", typ: "varchar", frm: "dayshours3" }
|
||||||
"columns": [
|
}
|
||||||
"id",
|
this.list = {
|
||||||
"discipline",
|
"columns": [
|
||||||
"description",
|
"id",
|
||||||
"issuegroup",
|
"discipline",
|
||||||
"service"
|
"description",
|
||||||
]
|
"issuegroup",
|
||||||
};
|
"service"
|
||||||
this.search = {
|
]
|
||||||
"autosearch": true,
|
};
|
||||||
"filters": ["discipline"]
|
this.search = {
|
||||||
};
|
"autosearch": true,
|
||||||
this.soft_delete = "mld_stdmelding_verwijder";
|
"filters": ["discipline"]
|
||||||
this.autfunction = "WEB_RESMSU";
|
};
|
||||||
this.record_title = L("lcl_mld_standaardmelding");
|
this.soft_delete = "mld_stdmelding_verwijder";
|
||||||
this.records_title = L("lcl_mld_stdmeldingen");
|
this.autfunction = "WEB_MLDMGT";
|
||||||
|
this.record_title = L("lcl_mld_standaardmelding");
|
||||||
|
this.records_title = L("lcl_mld_stdmeldingen");
|
||||||
|
|
||||||
api2.generic_REST(this);
|
api2.generic_REST(this, { GET: { tables: [ "ins_tab_discipline, mld_disc_params, ins_srtdiscipline" ],
|
||||||
|
wheres: [ "ins_tab_discipline.ins_discipline_key = mld_stdmelding.mld_ins_discipline_key",
|
||||||
|
"mld_disc_params.mld_ins_discipline_key = mld_stdmelding.mld_ins_discipline_key",
|
||||||
|
"ins_tab_discipline.ins_srtdiscipline_key = ins_srtdiscipline.ins_srtdiscipline_key"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (stdm_key > 0)
|
||||||
|
{
|
||||||
|
params.filter = params.filter || {};
|
||||||
|
params.filter.id = stdm_key;
|
||||||
|
|
||||||
|
var xxx_array = this.REST_GET(params);
|
||||||
|
if (!xxx_array.length)
|
||||||
|
shared.record_not_found();
|
||||||
|
this.data = xxx_array[0];
|
||||||
|
this.data.discipline = new model_discipline("MLD", this.data.discipline.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
Parameters:
|
Parameters:
|
||||||
Context:
|
Context:
|
||||||
|
|
||||||
Notes:
|
Notes: table en fields worden dynamisch per module bepaald
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -62,133 +62,113 @@ SELECT 'PRJ'
|
|||||||
<!-- #include file="model_objects.inc"-->
|
<!-- #include file="model_objects.inc"-->
|
||||||
<%
|
<%
|
||||||
|
|
||||||
model_notes =
|
function model_notes(module)
|
||||||
{
|
{
|
||||||
module: "FAC",
|
this.module = module;
|
||||||
table: "fac_v_notes",
|
// this.table = "fac_v_notes";
|
||||||
primary: "key",
|
this.records_name = "notes";
|
||||||
records_name: "notes",
|
this.record_name = "note";
|
||||||
record_name: "note",
|
|
||||||
fields: {"id" : { dbs: "key", typ: "key", filter: "exact" },
|
|
||||||
"writer" : { dbs: "writer_key", typ: "key", foreign: "prs_perslid", filter: "exact" },
|
|
||||||
"description" : { dbs: "omschrijving", typ: "varchar", filter: "like" },
|
|
||||||
"createdate" : { dbs: "aanmaak", typ: "datetime" }
|
|
||||||
// { name: "module", dbs: "module", typ: "varchar", filter: "exact" }
|
|
||||||
// { name: "parent", dbs: "parent_key", typ: "key", filter: "exact" } //niet terug linken
|
|
||||||
},
|
|
||||||
|
|
||||||
|
var tabel = {}; // De tabel met notes die aangepast moet worden.
|
||||||
_analyze_fields: function (dbfields, params, jsondata) /* analyseer inkomende data, common voor PUT en POST */
|
switch (module)
|
||||||
{
|
{
|
||||||
},
|
case "MLD":
|
||||||
|
{ tabel.naam = "mld_melding_note";
|
||||||
_validate_fields: function (dbfields, params, jsondata) /* valideer dbfields, alle constraints die niet door de database worden afgevangen */
|
tabel.seq = "mld_s_mld_melding_note_key";
|
||||||
{
|
tabel.parent = "mld_melding";
|
||||||
},
|
break;
|
||||||
|
|
||||||
_getNoteTable: function (module)
|
|
||||||
{
|
|
||||||
var tabel = {}; // De tabel met notes die aangepast moet worden.
|
|
||||||
switch (module)
|
|
||||||
{
|
|
||||||
case "MLD":
|
|
||||||
{ tabel.naam = "mld_melding_note";
|
|
||||||
tabel.seq = "mld_s_mld_melding_note_key";
|
|
||||||
tabel.parent = "mld_melding";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "ORD":
|
|
||||||
{ tabel.naam = "mld_opdr_note";
|
|
||||||
tabel.seq = "mld_s_mld_opdr_note_key";
|
|
||||||
tabel.parent = "mld_opdr";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "FIN":
|
|
||||||
{ tabel.naam = "fin_factuur_note";
|
|
||||||
tabel.seq = "fin_s_fin_factuur_note_key";
|
|
||||||
tabel.parent = "fin_factuur";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "CNT":
|
|
||||||
{ tabel.naam = "cnt_contract_note";
|
|
||||||
tabel.seq = "cnt_s_cnt_contract_note_key";
|
|
||||||
tabel.parent = "cnt_contract";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "PRJ":
|
|
||||||
{ tabel.naam = "prj_scenario_note";
|
|
||||||
tabel.seq = "prj_s_prj_scenario_note_key";
|
|
||||||
tabel.parent = "prj_scenario";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return tabel;
|
case "ORD":
|
||||||
},
|
{ tabel.naam = "mld_opdr_note";
|
||||||
|
tabel.seq = "mld_s_mld_opdr_note_key";
|
||||||
|
tabel.parent = "mld_opdr";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "FIN":
|
||||||
|
{ tabel.naam = "fin_factuur_note";
|
||||||
|
tabel.seq = "fin_s_fin_factuur_note_key";
|
||||||
|
tabel.parent = "fin_factuur";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "CNT":
|
||||||
|
{ tabel.naam = "cnt_contract_note";
|
||||||
|
tabel.seq = "cnt_s_cnt_contract_note_key";
|
||||||
|
tabel.parent = "cnt_contract";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "PRJ":
|
||||||
|
{ tabel.naam = "prj_scenario_note";
|
||||||
|
tabel.seq = "prj_s_prj_scenario_note_key";
|
||||||
|
tabel.parent = "prj_scenario";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.table = tabel.naam;
|
||||||
|
this.primary = tabel.parent + "_note_key";
|
||||||
|
this.fields =
|
||||||
|
{ "id" : { dbs: tabel.naam + "_key", typ: "key", seq: tabel.seq, filter: "exact" },
|
||||||
|
"author" : { dbs: "prs_perslid_key", typ: "key", foreign: "prs_perslid", filter: "exact" },
|
||||||
|
"description" : { dbs: tabel.naam + "_omschrijving", typ: "varchar", filter: "like" },
|
||||||
|
"createdate" : { dbs: tabel.naam + "_aanmaak", typ: "datetime" },
|
||||||
|
// { name: "module", dbs: "module", typ: "varchar", filter: "exact" }
|
||||||
|
"parent" : { dbs: tabel.parent + "_key", typ: "key", filter: "exact" }
|
||||||
|
};
|
||||||
|
|
||||||
REST_GET: function _GET(params)
|
this.list = {
|
||||||
|
"columns": [
|
||||||
|
"id",
|
||||||
|
"author",
|
||||||
|
"description",
|
||||||
|
"createdate"
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
this.REST_GET = function _GET(params)
|
||||||
{
|
{
|
||||||
var query = api2.sqlfields(params, model_notes );
|
var query = api2.sqlfields(params, this );
|
||||||
var wheres = api2.sqlfilter(params, model_notes);
|
var wheres = api2.sqlfilter(params, this);
|
||||||
query.wheres = query.wheres.concat(wheres);
|
query.wheres = query.wheres.concat(wheres);
|
||||||
|
|
||||||
var sql = "SELECT " + query.selects.join(", ")
|
var sql = "SELECT " + query.selects.join(", ")
|
||||||
+ " FROM " + query.tables.join(", ")
|
+ " FROM " + query.tables.join(", ");
|
||||||
+ (params.filter.id || params.filter.parent ? " WHERE " + query.wheres.join(" AND " ) : "");
|
if (query.wheres.length)
|
||||||
|
sql += " WHERE " + query.wheres.join(" AND " );
|
||||||
|
|
||||||
var json = api2.sql2json (params, sql, model_notes );
|
var json = api2.sql2json (params, sql, this );
|
||||||
|
|
||||||
return json;
|
return json;
|
||||||
},
|
};
|
||||||
|
|
||||||
REST_PUT: function (params, jsondata, the_key) /* update note */
|
this.REST_PUT = function (params, jsondata, the_key) /* update note */
|
||||||
{
|
{
|
||||||
// Een note kan alleen worden aangepast door de persoon die hem geschreven heeft.
|
// Een note kan alleen worden aangepast door de persoon die hem geschreven heeft.
|
||||||
// Alleen van de meest recente note bij een (melding/opdrachte/...) kan de omschrijving worden aangepast.
|
// Alleen van de meest recente note bij een (melding/opdracht/...) kan de omschrijving worden aangepast.
|
||||||
//
|
//
|
||||||
var dbfields = api2.update_fields(params, model_notes, jsondata); // Build updater
|
var dbfields = api2.update_fields(params, this, jsondata); // Build updater
|
||||||
|
|
||||||
var xxx_tabel = model_notes._getNoteTable(params.data.module); // De tabel met notes die aangepast moet worden.
|
var wheres = [ this.id.dbs + " = " + the_key];
|
||||||
// Wijzig de veldnamen overeenkomstig de te gebruiken tabel
|
wheres.push("prs_perslid = " + user_key);
|
||||||
for (i in dbfields)
|
|
||||||
{
|
var xxxUpd = buildTrackingUpdate(this.table, wheres.join(" AND " ), dbfields, { noValidateToken: true });
|
||||||
if (dbfields[i].dbs == "writer_key")
|
|
||||||
dbfields[i].dbs = "prs_perslid_key";
|
|
||||||
else
|
|
||||||
dbfields[i].dbs = xxx_tabel.naam + "_" + dbfields[i].dbs;
|
|
||||||
}
|
|
||||||
var wheres = [ xxx_tabel.naam+"_key = " + the_key];
|
|
||||||
var xxxUpd = buildTrackingUpdate(xxx_tabel.naam, wheres.join(" AND " ), dbfields, { noValidateToken: true });
|
|
||||||
|
|
||||||
Oracle.Execute(xxxUpd.sql);
|
Oracle.Execute(xxxUpd.sql);
|
||||||
|
|
||||||
return { key: the_key };
|
return { key: the_key };
|
||||||
},
|
};
|
||||||
|
|
||||||
REST_POST: function (params, jsondata) /* new note */
|
this.REST_POST = function (params, jsondata) /* new note */
|
||||||
{
|
{
|
||||||
params.isNew = true;
|
params.isNew = true;
|
||||||
//
|
//
|
||||||
var xxx_tabel = model_notes._getNoteTable(params.data.module); // De tabel met notes die aangepast moet worden.
|
|
||||||
var dbfields = [];
|
|
||||||
dbfields["writer"] = { dbs: "prs_perslid_key", typ: "key", val: user_key };
|
|
||||||
dbfields["parent"] = { dbs: xxx_tabel.parent+"_key", typ: "key", val: params.filter.id };
|
|
||||||
dbfields["created"] = { dbs: xxx_tabel.naam+"_aanmaak", typ: "datetime", val: new Date() };
|
|
||||||
dbfields["description"] = { dbs: xxx_tabel.naam+"_omschrijving", typ: "varchar", val: jsondata.description };
|
|
||||||
dbfields["id"] = { dbs: xxx_tabel.naam+"_key", typ: "key", seq: xxx_tabel.seq };
|
|
||||||
|
|
||||||
var xxxIns = buildInsert(xxx_tabel.naam, dbfields, { noValidateToken: true });
|
var xxxIns = buildInsert(this.table, dbfields, { noValidateToken: true });
|
||||||
var new_key = xxxIns.sequences[xxx_tabel.naam];
|
var new_key = xxxIns.sequences[xxx_tabel.naam];
|
||||||
|
|
||||||
var sql = "BEGIN "
|
|
||||||
+ xxxIns.sql + ";"
|
|
||||||
+ "END;";
|
|
||||||
Oracle.Execute(xxxIns.sql);
|
Oracle.Execute(xxxIns.sql);
|
||||||
|
|
||||||
return { key: new_key };
|
return { key: new_key };
|
||||||
},
|
|
||||||
|
|
||||||
REST_DELETE: function (params, the_key) /* delete note */
|
|
||||||
{ // Niet van toepassing.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// REST_DELETE = function (params, the_key) /* delete note doen we niet */
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
|
|||||||
@@ -79,15 +79,10 @@ function model_orders(opdr_key, params)
|
|||||||
// list: { columns: ["id", "name"], canGroup: true },
|
// list: { columns: ["id", "name"], canGroup: true },
|
||||||
this.includes = {
|
this.includes = {
|
||||||
"notes": {
|
"notes": {
|
||||||
model: model_notes,
|
model: new model_notes("MLD"),
|
||||||
joinfield: "parent_key",
|
joinfield: "mld_opdr_key"
|
||||||
joinfunction: function (params)
|
|
||||||
{
|
|
||||||
/* gaat uit dat die wordt geimplementeerd met een view fac_v_notes (module, key, columns....) */
|
|
||||||
return "(module='ORD' OR module IS NULL) AND fac_v_notes.parent_key(+) = mld_opdr.mld_opdr_key";
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"custom_fields" : { model: new model_custom_fields(this, "OPDR", { pNiveau: "O", readman: true, readuse: true }),
|
"custom_fields" : { model: new model_custom_fields(this, "MLD", { pNiveau: "O", readman: true, readuse: true }),
|
||||||
joinfield: "flexparentkey"
|
joinfield: "flexparentkey"
|
||||||
},
|
},
|
||||||
"tracking": {
|
"tracking": {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ model_regions =
|
|||||||
"name" : { dbs: "alg_regio_omschrijving", typ: "varchar", label: L("lcl_estate_regio_descr")},
|
"name" : { dbs: "alg_regio_omschrijving", typ: "varchar", label: L("lcl_estate_regio_descr")},
|
||||||
"deleted": { dbs: "alg_regio_verwijder", typ: "datetime"}
|
"deleted": { dbs: "alg_regio_verwijder", typ: "datetime"}
|
||||||
},
|
},
|
||||||
includes: { "districts": { model: model_districts }
|
includes: { "districts": { model: model_districts, joinfield: "region" }
|
||||||
},
|
},
|
||||||
|
|
||||||
_check_authorization: function(params, method)
|
_check_authorization: function(params, method)
|
||||||
@@ -83,7 +83,7 @@ model_regions =
|
|||||||
var sql = "SELECT " + query.selects.join(", ")
|
var sql = "SELECT " + query.selects.join(", ")
|
||||||
+ " FROM " + query.tables.join(", ")
|
+ " FROM " + query.tables.join(", ")
|
||||||
+ (query.wheres.length ? " WHERE " + query.wheres.join(" AND " ) : "")
|
+ (query.wheres.length ? " WHERE " + query.wheres.join(" AND " ) : "")
|
||||||
+ " ORDER BY alg_regio_omschrijving";
|
+ " ORDER BY alg_regio_key, alg_regio_omschrijving";
|
||||||
var json = api2.sql2json (params, sql, model_regions);
|
var json = api2.sql2json (params, sql, model_regions);
|
||||||
|
|
||||||
return json;
|
return json;
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ function model_reportcolumns(usrrap_key, params)
|
|||||||
this.record_name = "column";
|
this.record_name = "column";
|
||||||
this.records_title = L("lcl_rap_columns");
|
this.records_title = L("lcl_rap_columns");
|
||||||
this.record_title = L("lcl_rap_column");
|
this.record_title = L("lcl_rap_column");
|
||||||
this.parent_key = "fac_usrrap_key",
|
|
||||||
this.autfunction = "WEB_PRSSYS",
|
this.autfunction = "WEB_PRSSYS",
|
||||||
|
|
||||||
this.fields =
|
this.fields =
|
||||||
@@ -41,7 +40,9 @@ function model_reportcolumns(usrrap_key, params)
|
|||||||
LOV: L("lcl_rap_visibleLOV")}, // "V;Visible;I;Invisible;H;hidden"
|
LOV: L("lcl_rap_visibleLOV")}, // "V;Visible;I;Invisible;H;hidden"
|
||||||
"group" : { dbs: "fac_usrrap_cols_group", typ: "varchar", label: L("lcl_rap_groupby"),
|
"group" : { dbs: "fac_usrrap_cols_group", typ: "varchar", label: L("lcl_rap_groupby"),
|
||||||
required: true,
|
required: true,
|
||||||
LOV: L("lcl_rap_groupbyLOV") }
|
LOV: L("lcl_rap_groupbyLOV") },
|
||||||
|
"fac_usrrap_key" : { dbs: "fac_usrrap_key", typ: "key" }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.list = { columns: ["sequence", "name", "caption", "datatype", "visible", "filter", "group"] };
|
this.list = { columns: ["sequence", "name", "caption", "datatype", "visible", "filter", "group"] };
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ function model_reportsx(usrrap_key, params)
|
|||||||
sql += ", fac_usrrap_cols_volgnr";
|
sql += ", fac_usrrap_cols_volgnr";
|
||||||
|
|
||||||
var json = api2.sql2json (params, sql, this);
|
var json = api2.sql2json (params, sql, this);
|
||||||
if (json.length == 1 && params.include && json[0].columns.length == 0)
|
if (json.length == 1 && params.include && "columns" in params.include && json[0].columns.length == 0)
|
||||||
{
|
{
|
||||||
this.includes["columns"].model._view2columns(params.filter.id);
|
this.includes["columns"].model._view2columns(params.filter.id);
|
||||||
var json = api2.sql2json (params, sql, this );
|
var json = api2.sql2json (params, sql, this );
|
||||||
|
|||||||
@@ -28,14 +28,13 @@ model_reservationconsumables =
|
|||||||
primary: "res_rsv_artikel_key",
|
primary: "res_rsv_artikel_key",
|
||||||
records_name: "reservationconsumables",
|
records_name: "reservationconsumables",
|
||||||
record_name: "reservationconsumable",
|
record_name: "reservationconsumable",
|
||||||
parent_key: "res_rsv_ruimte_key",
|
|
||||||
|
|
||||||
fields: { "id" : { dbs: "res_rsv_artikel_key", typ: "key", filter: "exact" },
|
fields: { "id" : { dbs: "res_rsv_artikel_key", typ: "key", filter: "exact" },
|
||||||
|
"reservation": { dbs: "res_rsv_ruimte_key", typ: "key", filter: "exact", foreign: "res_rsv_ruimte" },
|
||||||
"consumable" : { dbs: "res_artikel_key", typ: "key", filter: "exact", foreign: "res_artikel" },
|
"consumable" : { dbs: "res_artikel_key", typ: "key", filter: "exact", foreign: "res_artikel" },
|
||||||
"amount" : { dbs: "res_rsv_artikel_aantal", typ: "number"},
|
"amount" : { dbs: "res_rsv_artikel_aantal", typ: "number"},
|
||||||
"status" : { dbs: "res_status_bo_key", typ: "number", filter: "exact", foreign: status_bo },
|
"status" : { dbs: "res_status_bo_key", typ: "number", filter: "exact", foreign: status_bo },
|
||||||
"reservation": { dbs: "res_rsv_ruimte_key", typ: "key", filter: "exact", foreign: "res_rsv_ruimte" },
|
"from" : { dbs: "res_rsv_artikel_levering", typ: "time", filter: "exact" },
|
||||||
"from" : { dbs: "res_rsv_artikel_levering", typ: "date", filter: "exact" },
|
|
||||||
//: "to" { dbs: "res_rsv_artikel_tot", typ: "date" },
|
//: "to" { dbs: "res_rsv_artikel_tot", typ: "date" },
|
||||||
"price" : { dbs: "res_rsv_artikel_prijs", typ: "float" },
|
"price" : { dbs: "res_rsv_artikel_prijs", typ: "float" },
|
||||||
"processed" : { dbs: "res_rsv_artikel_verwerkt", typ: "datetime" },
|
"processed" : { dbs: "res_rsv_artikel_verwerkt", typ: "datetime" },
|
||||||
@@ -43,6 +42,7 @@ model_reservationconsumables =
|
|||||||
"changed" : { dbs: "res_rsv_artikel_mutatie", typ: "datetime" },
|
"changed" : { dbs: "res_rsv_artikel_mutatie", typ: "datetime" },
|
||||||
"dirtlevel" : { dbs: "res_rsv_artikel_dirtlevel", typ: "number", filter: "exact" }
|
"dirtlevel" : { dbs: "res_rsv_artikel_dirtlevel", typ: "number", filter: "exact" }
|
||||||
},
|
},
|
||||||
|
list: { columns: [ "id", "from", "amount", "consumable", "price" ] },
|
||||||
|
|
||||||
REST_GET: function _GET(params)
|
REST_GET: function _GET(params)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ model_reservationequipment =
|
|||||||
primary: "res_rsv_deel_key",
|
primary: "res_rsv_deel_key",
|
||||||
records_name: "reservationequipment",
|
records_name: "reservationequipment",
|
||||||
record_name: "reservationequipment",
|
record_name: "reservationequipment",
|
||||||
parent_key: "res_rsv_ruimte_key",
|
|
||||||
|
|
||||||
fields: {"id" : { dbs: "res_rsv_deel_key", typ: "key", filter: "exact" },
|
fields: {"id" : { dbs: "res_rsv_deel_key", typ: "key", filter: "exact" },
|
||||||
|
"reservation": { dbs: "res_rsv_ruimte_key", typ: "key", filter: "exact", foreign: "res_rsv_ruimte" },
|
||||||
"equipment" : { dbs: "res_deel_key", typ: "key", filter: "exact", foreign: "res_deel" },
|
"equipment" : { dbs: "res_deel_key", typ: "key", filter: "exact", foreign: "res_deel" },
|
||||||
"status" : { dbs: "res_status_bo_key", typ: "key", filter: "exact", foreign: res.getbostatustext },
|
"status" : { dbs: "res_status_bo_key", typ: "key", filter: "exact", foreign: res.getbostatustext },
|
||||||
"from" : { dbs: "res_rsv_deel_van", typ: "datetime", filter: "exact" },
|
"from" : { dbs: "res_rsv_deel_van", typ: "datetime", filter: "exact" },
|
||||||
@@ -45,9 +45,10 @@ model_reservationequipment =
|
|||||||
"changed" : { dbs: "res_rsv_deel_mutatie", typ: "datetime" },
|
"changed" : { dbs: "res_rsv_deel_mutatie", typ: "datetime" },
|
||||||
"dirtlevel" : { dbs: "res_rsv_deel_dirtlevel", typ: "number", filter: "exact" }
|
"dirtlevel" : { dbs: "res_rsv_deel_dirtlevel", typ: "number", filter: "exact" }
|
||||||
// altijd 1 { name: "number", dbs: "res_rsv_deel_aantal", typ: "number", filter: "exact" }
|
// altijd 1 { name: "number", dbs: "res_rsv_deel_aantal", typ: "number", filter: "exact" }
|
||||||
// niet terug linken { name: "reservation", dbs: "res_rsv_ruimte_key", typ: "key", filter: "exact", foreign: "res_rsv_ruimte" }
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
list: { columns: [ "id", "from", "to", "equipment", "price" ] },
|
||||||
|
|
||||||
REST_GET: function _GET(params)
|
REST_GET: function _GET(params)
|
||||||
{
|
{
|
||||||
var urole = "fe"; // TODO: Moet echt niet ter zake doen
|
var urole = "fe"; // TODO: Moet echt niet ter zake doen
|
||||||
|
|||||||
@@ -66,11 +66,11 @@ function model_reservations(rsv_key, params)
|
|||||||
this.list = { columns: ["id", "name", "from", "to"] };
|
this.list = { columns: ["id", "name", "from", "to"] };
|
||||||
this.includes =
|
this.includes =
|
||||||
{"reservationequipment": { model: model_reservationequipment,
|
{"reservationequipment": { model: model_reservationequipment,
|
||||||
joinfield: "res_rsv_ruimte_key",
|
joinfield: "reservation",
|
||||||
enable_update: true
|
enable_update: true
|
||||||
},
|
},
|
||||||
"reservationconsumables": { model: model_reservationconsumables,
|
"reservationconsumables": { model: model_reservationconsumables,
|
||||||
joinfield: "res_rsv_ruimte_key"
|
joinfield: "reservation"
|
||||||
},
|
},
|
||||||
"tracking": {
|
"tracking": {
|
||||||
model: new model_tracking(['reservering', 'xreservering']),
|
model: new model_tracking(['reservering', 'xreservering']),
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ function model_tracking(xmlnodes)
|
|||||||
this.primary = "fac_tracking_key";
|
this.primary = "fac_tracking_key";
|
||||||
this.records_name = "tracking";
|
this.records_name = "tracking";
|
||||||
this.record_name = "tracking";
|
this.record_name = "tracking";
|
||||||
this.parent_key = "fac_tracking_refkey";
|
|
||||||
|
|
||||||
this.tablesql = "(SELECT fac_tracking_key,"
|
this.tablesql = "(SELECT fac_tracking_key,"
|
||||||
+ " ft.fac_srtnotificatie_key,"
|
+ " ft.fac_srtnotificatie_key,"
|
||||||
@@ -35,12 +34,19 @@ function model_tracking(xmlnodes)
|
|||||||
+ " fac_tracking";
|
+ " fac_tracking";
|
||||||
|
|
||||||
this.fields =
|
this.fields =
|
||||||
{ "id": { dbs: "fac_tracking_key", typ: "key" },
|
{ "id": { dbs: "fac_tracking_key", typ: "key" },
|
||||||
"notification": { dbs: "fac_srtnotificatie_key", typ: "key", foreign: "FAC_SRTNOTIFICATIE" },
|
"notification": { dbs: "fac_srtnotificatie_key", typ: "key", foreign: "FAC_SRTNOTIFICATIE" },
|
||||||
"date": { dbs: "fac_tracking_datum", typ: "date" },
|
"date": { dbs: "fac_tracking_datum", typ: "datetime" },
|
||||||
"description": { dbs: "fac_tracking_oms", typ: "varchar" },
|
"description": { dbs: "fac_tracking_oms", typ: "varchar" },
|
||||||
"person": { dbs: "prs_perslid_key", typ: "varchar", foreign: "PRS_PERSLID" }
|
"person": { dbs: "prs_perslid_key", typ: "varchar", foreign: "PRS_PERSLID" },
|
||||||
|
"fac_tracking_refkey": { dbs: "fac_tracking_refkey", typ: "key" }
|
||||||
};
|
};
|
||||||
|
this.list = { columns: ["id", "date", "notification", "description", "person"] },
|
||||||
|
|
||||||
|
// TODO: Hoe controleren dat ik wel rechten heb op deze tracking?
|
||||||
|
this.autfunction = "WEB_RESUSE"; // valsspelen TODO
|
||||||
|
this.REST_GET = generic_REST_GET(this, {});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
%>
|
%>
|
||||||
@@ -20,15 +20,14 @@ model_visitors =
|
|||||||
primary: "bez_bezoekers_key",
|
primary: "bez_bezoekers_key",
|
||||||
records_name: "visitors",
|
records_name: "visitors",
|
||||||
record_name: "visitor",
|
record_name: "visitor",
|
||||||
parent_key: "bez_afspraak_key",
|
|
||||||
|
|
||||||
fields: {"id" : { dbs: "bez_bezoekers_key", typ: "key", filter: "exact" },
|
fields: {"id" : { dbs: "bez_bezoekers_key", typ: "key", filter: "exact" },
|
||||||
"name" : { dbs: "bez_afspraak_naam", typ: "varchar", label: L("lcl_vis_name")},
|
"name" : { dbs: "bez_afspraak_naam", typ: "varchar", label: L("lcl_vis_name")},
|
||||||
"company": { dbs: "bez_afspraak_bedrijf", typ: "varchar", label: L("lcl_vis_company")},
|
"company" : { dbs: "bez_afspraak_bedrijf", typ: "varchar", label: L("lcl_vis_company")},
|
||||||
"badge" : { dbs: "bez_bezoekers_pasnr", typ: "varchar", label: L("lcl_vis_badgenr")},
|
"badge" : { dbs: "bez_bezoekers_pasnr", typ: "varchar", label: L("lcl_vis_badgenr")},
|
||||||
"in" : { dbs: "bez_bezoekers_done", typ: "datetime", label: L("lcl_bez_done_date")},
|
"in" : { dbs: "bez_bezoekers_done", typ: "datetime", label: L("lcl_bez_done_date")},
|
||||||
"out" : { dbs: "bez_bezoekers_out", typ: "datetime", label: L("lcl_bez_out_date")}
|
"out" : { dbs: "bez_bezoekers_out", typ: "datetime", label: L("lcl_bez_out_date")},
|
||||||
// niet teruglinken, { name: "appointment", dbs: "bez_afspraak_key", typ: "key", foreign: "bez_afspraak"}
|
"appointment": { dbs: "bez_afspraak_key", typ: "key", xforeign: "bez_afspraak"}
|
||||||
},
|
},
|
||||||
list: { columns: ["name", "company", "in", "out"] },
|
list: { columns: ["name", "company", "in", "out"] },
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
Context:
|
Context:
|
||||||
Note:
|
Note:
|
||||||
*/
|
*/
|
||||||
if (!this.JSON_Result)
|
if (!this.JSON_Result && !Request.QueryString("api2").Count)
|
||||||
FCLTHeader.Requires({css: ["../res/res.css"] });
|
FCLTHeader.Requires({css: ["../res/res.css"] });
|
||||||
|
|
||||||
res = {
|
res = {
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ function scaffolding(model, scf_params)
|
|||||||
var imodel = getQParam("model", ""); // include model
|
var imodel = getQParam("model", ""); // include model
|
||||||
if (model.includes && imodel in model.includes)
|
if (model.includes && imodel in model.includes)
|
||||||
{
|
{
|
||||||
|
scf_params.incsetting = model.includes[imodel];
|
||||||
model = model.includes[imodel].model;
|
model = model.includes[imodel].model;
|
||||||
if (typeof model == "function") // Nieuwe stijl is het een function. Even compatible.
|
if (typeof model == "function") // Nieuwe stijl is het een function. Even compatible.
|
||||||
model = new model();
|
model = new model();
|
||||||
|
|||||||
@@ -109,6 +109,12 @@ function scaffolding_list(model, scf_params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
var xxx_params = { filter : scf_params.filter || shared.qs2json(), columns: scf_params.list.columns, groupby: scf_params.list.groups };
|
var xxx_params = { filter : scf_params.filter || shared.qs2json(), columns: scf_params.list.columns, groupby: scf_params.list.groups };
|
||||||
|
|
||||||
|
if (scf_params.incsetting && "id" in xxx_params.filter) // Zijn we eigenlijk een include?
|
||||||
|
{ // dan moet de id-filter op het joinfield
|
||||||
|
xxx_params.filter[scf_params.incsetting.joinfield] = xxx_params.filter["id"];
|
||||||
|
delete xxx_params.filter["id"];
|
||||||
|
}
|
||||||
if (!("limit" in xxx_params.filter))
|
if (!("limit" in xxx_params.filter))
|
||||||
{
|
{
|
||||||
xxx_params.filter.limit = showAll?S("qp_maxrows2"):S("qp_maxrows")
|
xxx_params.filter.limit = showAll?S("qp_maxrows2"):S("qp_maxrows")
|
||||||
|
|||||||
@@ -73,11 +73,11 @@ function scaffolding_wrap(model, scf_params)
|
|||||||
for (var inc in model.includes)
|
for (var inc in model.includes)
|
||||||
{
|
{
|
||||||
var include = model.includes[inc];
|
var include = model.includes[inc];
|
||||||
if (include.joinfield == model.fields["id"].dbs)
|
if (!include.joinfunction) // die is te ingewikkeld?
|
||||||
{
|
{
|
||||||
var filter = {};
|
var url = scf_params.this_fullpath + "?mode=list&model=" + inc;
|
||||||
filter[include.joinfield] = key;
|
// Vanuit fac_reportx heeft fullpath geen id in zich verwerkt. Daarom nog maar een keer in de url
|
||||||
var url = scf_params.this_fullpath + "?mode=list&model=" + inc + "&pid=" + key;
|
url += "&id=" + key;
|
||||||
IFRAMER("xxxFrame", url, { FcltClose: "scfClose" } );
|
IFRAMER("xxxFrame", url, { FcltClose: "scfClose" } );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -798,6 +798,19 @@ safe = {
|
|||||||
return "NULL";
|
return "NULL";
|
||||||
return safe.quoted_sql(tekst.toUpperCase().replace(/\*/g, "%"), maxlen);
|
return safe.quoted_sql(tekst.toUpperCase().replace(/\*/g, "%"), maxlen);
|
||||||
},
|
},
|
||||||
|
// converteer alle waarden in arr naar integer.
|
||||||
|
// waar dat niet lukt worden ze gewoon verwijderd(?)
|
||||||
|
int_array: function (arr)
|
||||||
|
{
|
||||||
|
var safe_arr = [];
|
||||||
|
for (var i = 0; i < arr.length; i++)
|
||||||
|
{
|
||||||
|
var v = parseInt(arr[i], 10);
|
||||||
|
if (!isNaN(v))
|
||||||
|
safe_arr.push(v);
|
||||||
|
}
|
||||||
|
return safe_arr;
|
||||||
|
},
|
||||||
|
|
||||||
filename: function (naam) // geen 'lage' karakters en geen (back)slashes, *,%,<,>, '"', ':', ';' '?' and '|'
|
filename: function (naam) // geen 'lage' karakters en geen (back)slashes, *,%,<,>, '"', ':', ';' '?' and '|'
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user